|
| 1 | +attr global userattr cmdIcon devStateIcon:textField-long devStateStyle icon sortby webCmd webCmdLabel:textField-long widgetOverride |
| 2 | +attr global autosave 0 |
| 3 | +attr global logfile log/fhem-%Y-%m-%d.log |
| 4 | +attr global modpath . |
| 5 | +attr global nofork 0 |
| 6 | +attr global pidfilename log/fhem.pid |
| 7 | +attr global statefile ./log/fhem.save |
| 8 | +attr global updateInBackground 1 |
| 9 | +attr global verbose 3 |
| 10 | +# FHEM Configuration for PySignalduino Dev Environment |
| 11 | +# |
| 12 | +# This file is loaded by the FHEM container via CONFIGTYPE environment variable. |
| 13 | + |
| 14 | + |
| 15 | +# 1. Define FHEMWEB instance to access FHEM via Browser (Port 8083) |
| 16 | +define WEB FHEMWEB 8083 global |
| 17 | +setuuid WEB 695e9c21-f33f-c986-956a-7e26fc9adfc69728 |
| 18 | +attr WEB editConfig 1 |
| 19 | +attr WEB stylesheetPrefix dark |
| 20 | + |
| 21 | +# 2. Define Telnet for command line access (Optional) |
| 22 | +#define telnetPort telnet 7072 global |
| 23 | + |
| 24 | +# 3. Basic Event Handling |
| 25 | +define eventTypes eventTypes ./log/eventTypes.txt |
| 26 | +setuuid eventTypes 695e9c21-f33f-c986-9ac3-190c47641a98acb9 |
| 27 | + |
| 28 | +# 4. Define the MQTT Client (Broker Connection) |
| 29 | +# 'mqtt' is the hostname of the broker service in docker-compose.yml |
| 30 | +define mqtt_broker MQTT2_CLIENT mqtt:1883 |
| 31 | +setuuid mqtt_broker 695e9c21-f33f-c986-e617-d7301881c4685bc6 |
| 32 | +attr mqtt_broker autocreate simple |
| 33 | + |
| 34 | +# 5. Define the SignalDuino MQTT Device |
| 35 | +define PySignalDuino MQTT2_DEVICE |
| 36 | +setuuid PySignalDuino 695e9c21-f33f-c986-4f81-a9f0ab37b6bcedf8 |
| 37 | +attr PySignalDuino IODev mqtt_broker |
| 38 | +attr PySignalDuino readingList signalduino/v1/state/messages:.* { json2nameValue($EVENT, 'MSG_',$JSONMAP) }\ |
| 39 | + signalduino/v1/responses:.* { json2nameValue($EVENT, 'RESP_') }\ |
| 40 | + signalduino/v1/errors:.* { json2nameValue($EVENT, 'ERR_') } |
| 41 | +attr PySignalDuino setList raw:textField signalduino/v1/commands/set/raw $EVTPART1 \ |
| 42 | + cc1101_reg:textField signalduino/v1/commands/set/cc1101_reg $EVTPART1 \ |
| 43 | + # System GET commands (noArg) \ |
| 44 | + version:noArg signalduino/v1/commands/get/system/version \ |
| 45 | + freeram:noArg signalduino/v1/commands/get/system/freeram \ |
| 46 | + uptime:noArg signalduino/v1/commands/get/system/uptime \ |
| 47 | + # Decoder state commands \ |
| 48 | + decoder_state:noArg signalduino/v1/commands/get/config/decoder \ |
| 49 | + decoder_ms_enable:noArg signalduino/v1/commands/set/config/decoder_ms_enable \ |
| 50 | + decoder_ms_disable:noArg signalduino/v1/commands/set/config/decoder_ms_disable \ |
| 51 | + decoder_mu_enable:noArg signalduino/v1/commands/set/config/decoder_mu_enable \ |
| 52 | + decoder_mu_disable:noArg signalduino/v1/commands/set/config/decoder_mu_disable \ |
| 53 | + decoder_mc_enable:noArg signalduino/v1/commands/set/config/decoder_mc_enable \ |
| 54 | + decoder_mc_disable:noArg signalduino/v1/commands/set/config/decoder_mc_disable \ |
| 55 | + # CC1101 GET commands (noArg) \ |
| 56 | + cc_config:noArg signalduino/v1/commands/get/cc1101/config \ |
| 57 | + cc_patable_get:noArg signalduino/v1/commands/get/cc1101/patable \ |
| 58 | + cc_register:noArg signalduino/v1/commands/get/cc1101/register \ |
| 59 | + cc_freq_get:noArg signalduino/v1/commands/get/cc1101/frequency \ |
| 60 | + cc_bandwidth_get:noArg signalduino/v1/commands/get/cc1101/bandwidth \ |
| 61 | + cc_rampl_get:noArg signalduino/v1/commands/get/cc1101/rampl \ |
| 62 | + cc_sensitivity_get:noArg signalduino/v1/commands/get/cc1101/sensitivity \ |
| 63 | + cc_datarate_get:noArg signalduino/v1/commands/get/cc1101/datarate \ |
| 64 | + cc_settings_get:noArg signalduino/v1/commands/get/cc1101/settings \ |
| 65 | + cc_deviation_get:noArg signalduino/v1/commands/get/cc1101/deviation\ |
| 66 | + # CC1101 SET commands \ |
| 67 | + cc_frequency_set:textField signalduino/v1/commands/set/cc1101/frequency $EVTPART1 \ |
| 68 | + cc_rampl_set:select,24,27,30,33,36,38,40,42 signalduino/v1/commands/set/cc1101/rampl $EVTPART1 \ |
| 69 | + cc_sensitivity_set:select,4,8,12,16 signalduino/v1/commands/set/cc1101/sensitivity $EVTPART1 \ |
| 70 | + cc_patable_set:select,-30_dBm,-20_dBm,-15_dBm,-10_dBm,-5_dBm,0_dBm,5_dBm,7_dBm,10_dBm signalduino/v1/commands/set/cc1101/patable $EVTPART1 \ |
| 71 | + cc_bandwidth_set:textField signalduino/v1/commands/set/cc1101/bandwidth $EVTPART1 \ |
| 72 | + cc_datarate_set:textField signalduino/v1/commands/set/cc1101/datarate $EVTPART1 \ |
| 73 | + cc_deviation_set:textField signalduino/v1/commands/set/cc1101/deviation $EVTPART1 \ |
| 74 | +\ |
| 75 | + # Maintenance commands \ |
| 76 | + factory_reset:noArg signalduino/v1/commands/set/factory_reset |
| 77 | +attr PySignalDuino stateFormat state |
| 78 | +# Map JSON payload to readings |
| 79 | +# Define setter commands |
| 80 | + |
| 81 | +# Logfile for SignalDuino |
| 82 | +define FileLog_PySignalDuino FileLog ./log/PySignalDuino-%Y.log PySignalDuino |
| 83 | +setuuid FileLog_PySignalDuino 695e9c21-f33f-c986-1981-abe9a5a366b3c989 |
| 84 | +attr FileLog_PySignalDuino logtype text |
| 85 | +define Logfile FileLog /opt/fhem/log/fhem-%Y-%m-%d.log Logfile |
| 86 | +setuuid Logfile 695e9c21-f33f-c986-cfda-4915c3e60c145721 |
0 commit comments