Auch auf die Gefahr hin, dass ich gleich Mecker bekomme: " les doch mal hier!" ;)
Habe schon ewig rumgesucht und nix gefunden. Habe eine Shelly 2.5 auf Tasmota umgeflasht und via MQTT Broker eingebunden. Funktioniert soweit super, Device wure automatisch angelegt und Template hat den Rest gemacht.
Mir fehlen nur komischerweise die readings Power, ApperantPower und ReactivePower für den 2. Kanal. Factor und Current dagegen werden korrekt mit _1 und _2 angelegt.
Hat jemand eine Idee, warum diese nicht geniert werden? Ich seh den Wald vor lauter Bäumen nicht mehr.
Internals:
CFGFN
CID DVES_FB10D7
DEF DVES_FB10D7
DEVICETOPIC Shelly_Reserve
FUUID 5f0df36b-f33f-a09f-c9b7-6b5ac4f5da715bb4
IODev MQTT_broker
LASTInputDev MQTT_broker
MQTT_broker_MSGCNT 954
MQTT_broker_TIME 2020-07-15 12:18:38
MSGCNT 954
NAME Shelly_Reserve
NR 82757
STATE off
TYPE MQTT2_DEVICE
JSONMAP:
Channel_0 0
Channel_1 0
Channel_2 0
Channel_3 0
Channel_4 0
Color 0
Dimmer 0
HSBColor 0
POWER1 0
POWER2 0
POWER3 0
POWER4 0
OLDREADINGS:
READINGS:
2020-07-15 12:18:38 ANALOG_Temperature 73.1
2020-07-15 09:37:36 BASE 18
2020-07-15 09:37:36 BlinkCount 10
2020-07-15 09:37:36 BlinkTime 10
2020-07-15 09:37:36 ButtonDebounce 50
2020-07-15 11:56:38 Command Error
2020-07-15 12:18:38 ENERGY_ApparentPower_1 0
2020-07-15 12:18:38 ENERGY_Current_1 0.000
2020-07-15 12:18:38 ENERGY_Current_2 0.000
2020-07-15 12:18:38 ENERGY_Factor_1 0.00
2020-07-15 12:18:38 ENERGY_Factor_2 0.00
2020-07-15 12:18:38 ENERGY_Frequency 0
2020-07-15 12:18:38 ENERGY_Period 0
2020-07-15 12:18:38 ENERGY_Power_1 0
2020-07-15 12:18:38 ENERGY_ReactivePower_1 0
2020-07-15 12:18:38 ENERGY_Today 0.000
2020-07-15 12:18:38 ENERGY_Total 0.000
2020-07-15 12:18:38 ENERGY_TotalStartTime 2020-07-14T18:35:50
2020-07-15 12:18:38 ENERGY_Voltage 0
2020-07-15 12:18:38 ENERGY_Yesterday 0.000
2020-07-15 09:37:36 FLAG 2
2020-07-15 10:13:50 FallbackTopic cmnd/shellyswitch25_FB10D7_fb/
2020-07-15 08:25:18 FullTopic %prefix%/%topic%/
2020-07-15 09:37:36 GPIO10_0 None
2020-07-15 09:37:36 GPIO1_0 None
2020-07-15 09:37:36 GPIO3_0 None
2020-07-15 09:37:36 GPIO9_0 None
2020-07-15 09:37:36 GPIO_1 56
2020-07-15 09:37:36 GPIO_10 82
2020-07-15 09:37:36 GPIO_11 5
2020-07-15 09:37:36 GPIO_12 22
2020-07-15 09:37:36 GPIO_13 156
2020-07-15 09:37:36 GPIO_2 255
2020-07-15 09:37:36 GPIO_3 17
2020-07-15 09:37:36 GPIO_4 255
2020-07-15 09:37:36 GPIO_5 21
2020-07-15 09:37:36 GPIO_6 83
2020-07-15 09:37:36 GPIO_7 255
2020-07-15 09:37:36 GPIO_8 255
2020-07-15 09:37:36 GPIO_9 6
2020-07-15 09:37:35 GPIOs1_0 None
2020-07-15 09:37:35 GPIOs1_10 Switch2
2020-07-15 09:37:35 GPIOs1_11 Switch3
2020-07-15 09:37:35 GPIOs1_12 Switch4
2020-07-15 09:37:35 GPIOs1_122 Button1i
2020-07-15 09:37:35 GPIOs1_123 Button2i
2020-07-15 09:37:35 GPIOs1_124 Button3i
2020-07-15 09:37:35 GPIOs1_125 Button4i
2020-07-15 09:37:35 GPIOs1_126 Button1in
2020-07-15 09:37:35 GPIOs1_127 Button2in
2020-07-15 09:37:35 GPIOs1_128 Button3in
2020-07-15 09:37:35 GPIOs1_129 Button4in
2020-07-15 09:37:35 GPIOs1_13 Switch5
2020-07-15 09:37:35 GPIOs1_14 Switch6
2020-07-15 09:37:35 GPIOs1_15 Switch7
2020-07-15 09:37:35 GPIOs1_16 Switch8
2020-07-15 09:37:35 GPIOs1_17 Button1
2020-07-15 09:37:35 GPIOs1_18 Button2
2020-07-15 09:37:35 GPIOs1_19 Button3
2020-07-15 09:37:35 GPIOs1_20 Button4
2020-07-15 09:37:35 GPIOs1_21 Relay1
2020-07-15 09:37:35 GPIOs1_29 Relay1i
2020-07-15 09:37:35 GPIOs1_82 Switch1n
2020-07-15 09:37:35 GPIOs1_83 Switch2n
2020-07-15 09:37:35 GPIOs1_84 Switch3n
2020-07-15 09:37:35 GPIOs1_85 Switch4n
2020-07-15 09:37:35 GPIOs1_86 Switch5n
2020-07-15 09:37:35 GPIOs1_87 Switch6n
2020-07-15 09:37:35 GPIOs1_88 Switch7n
2020-07-15 09:37:35 GPIOs1_89 Switch8n
2020-07-15 09:37:35 GPIOs1_9 Switch1
2020-07-15 09:37:35 GPIOs1_90 Button1n
2020-07-15 09:37:35 GPIOs1_91 Button2n
2020-07-15 09:37:35 GPIOs1_92 Button3n
2020-07-15 09:37:35 GPIOs1_93 Button4n
2020-07-15 09:37:35 GPIOs2_157 LedLink
2020-07-15 09:37:35 GPIOs2_158 LedLinki
2020-07-15 09:37:35 GPIOs2_22 Relay2
2020-07-15 09:37:35 GPIOs2_23 Relay3
2020-07-15 09:37:35 GPIOs2_24 Relay4
2020-07-15 09:37:35 GPIOs2_25 Relay5
2020-07-15 09:37:35 GPIOs2_26 Relay6
2020-07-15 09:37:35 GPIOs2_27 Relay7
2020-07-15 09:37:35 GPIOs2_28 Relay8
2020-07-15 09:37:35 GPIOs2_30 Relay2i
2020-07-15 09:37:35 GPIOs2_31 Relay3i
2020-07-15 09:37:35 GPIOs2_32 Relay4i
2020-07-15 09:37:35 GPIOs2_33 Relay5i
2020-07-15 09:37:35 GPIOs2_34 Relay6i
2020-07-15 09:37:35 GPIOs2_35 Relay7i
2020-07-15 09:37:35 GPIOs2_36 Relay8i
2020-07-15 09:37:35 GPIOs2_37 PWM1
2020-07-15 09:37:35 GPIOs2_38 PWM2
2020-07-15 09:37:35 GPIOs2_39 PWM3
2020-07-15 09:37:35 GPIOs2_40 PWM4
2020-07-15 09:37:35 GPIOs2_41 PWM5
2020-07-15 09:37:35 GPIOs2_42 Counter1
2020-07-15 09:37:35 GPIOs2_43 Counter2
2020-07-15 09:37:35 GPIOs2_44 Counter3
2020-07-15 09:37:35 GPIOs2_46 PWM1i
2020-07-15 09:37:35 GPIOs2_47 PWM2i
2020-07-15 09:37:35 GPIOs2_48 PWM3i
2020-07-15 09:37:35 GPIOs2_49 PWM4i
2020-07-15 09:37:35 GPIOs2_50 PWM5i
2020-07-15 09:37:35 GPIOs2_52 Led1
2020-07-15 09:37:35 GPIOs2_53 Led2
2020-07-15 09:37:35 GPIOs2_54 Led3
2020-07-15 09:37:35 GPIOs2_55 Led4
2020-07-15 09:37:35 GPIOs2_56 Led1i
2020-07-15 09:37:35 GPIOs2_57 Led2i
2020-07-15 09:37:35 GPIOs2_58 Led3i
2020-07-15 09:37:35 GPIOs2_59 Led4i
2020-07-15 09:37:35 GPIOs2_94 Counter1n
2020-07-15 09:37:35 GPIOs2_95 Counter2n
2020-07-15 09:37:35 GPIOs3_1 DHT11
2020-07-15 09:37:35 GPIOs3_107 Tuya Tx
2020-07-15 09:37:35 GPIOs3_108 Tuya Rx
2020-07-15 09:37:35 GPIOs3_130 HLWBL SEL
2020-07-15 09:37:35 GPIOs3_131 HLWBL SELi
2020-07-15 09:37:35 GPIOs3_140 SM16716 CLK
2020-07-15 09:37:35 GPIOs3_141 SM16716 DAT
2020-07-15 09:37:35 GPIOs3_142 SM16716 PWR
2020-07-15 09:37:35 GPIOs3_143 MY92x1 DI
2020-07-15 09:37:35 GPIOs3_144 MY92x1 DCKI
2020-07-15 09:37:35 GPIOs3_147 ALux IrRcv
2020-07-15 09:37:35 GPIOs3_148 Serial Tx
2020-07-15 09:37:35 GPIOs3_149 Serial Rx
2020-07-15 09:37:35 GPIOs3_159 ALux IrSel
2020-07-15 09:37:35 GPIOs3_160 Buzzer
2020-07-15 09:37:35 GPIOs3_161 Buzzeri
2020-07-15 09:37:35 GPIOs3_180 SM2135 Clk
2020-07-15 09:37:35 GPIOs3_181 SM2135 Dat
2020-07-15 09:37:35 GPIOs3_183 EXS Enable
2020-07-15 09:37:35 GPIOs3_192 DS18x20o
2020-07-15 09:37:35 GPIOs3_193 DHT11o
2020-07-15 09:37:35 GPIOs3_2 AM2301
2020-07-15 09:37:35 GPIOs3_201 MOODL Tx
2020-07-15 09:37:35 GPIOs3_3 SI7021
2020-07-15 09:37:35 GPIOs3_4 DS18x20
2020-07-15 09:37:35 GPIOs3_45 Counter4
2020-07-15 09:37:35 GPIOs3_5 I2C SCL
2020-07-15 09:37:35 GPIOs3_51 IRrecv
2020-07-15 09:37:35 GPIOs3_6 I2C SDA
2020-07-15 09:37:35 GPIOs3_7 WS2812
2020-07-15 09:37:35 GPIOs3_8 IRsend
2020-07-15 09:37:35 GPIOs3_96 Counter3n
2020-07-15 09:37:35 GPIOs3_97 Counter4n
2020-07-15 09:37:36 GPIOs4_132 HLWBL CF1
2020-07-15 09:37:36 GPIOs4_133 HLW8012 CF
2020-07-15 09:37:36 GPIOs4_134 BL0937 CF
2020-07-15 09:37:36 GPIOs4_135 MCP39F5 Tx
2020-07-15 09:37:36 GPIOs4_136 MCP39F5 Rx
2020-07-15 09:37:36 GPIOs4_137 MCP39F5 Rst
2020-07-15 09:37:36 GPIOs4_145 CSE7766 Tx
2020-07-15 09:37:36 GPIOs4_146 CSE7766 Rx
2020-07-15 09:37:36 GPIOs4_156 ADE7953 IRQ
2020-07-15 09:37:36 GPIOs4_182 DeepSleep
2020-07-15 09:37:36 GPIOs4_62 PZEM0XX Tx
2020-07-15 09:37:36 GPIOs4_63 PZEM004 Rx
2020-07-15 09:37:36 GPIOs4_71 SerBr Tx
2020-07-15 09:37:36 GPIOs4_72 SerBr Rx
2020-07-15 09:37:36 GPIOs4_98 PZEM016 Rx
2020-07-15 09:37:36 GPIOs4_99 PZEM017 Rx
2020-07-15 10:13:50 GroupTopic cmnd/tasmotas/
2020-07-15 09:37:36 Groups 1,2
2020-07-15 12:18:37 Heap 26
2020-07-15 10:13:50 Hostname tasmota_FB10D7-4311
2020-07-15 10:13:50 IPAddress 192.168.0.201
2020-07-15 09:37:36 Interlock off
2020-07-15 10:13:50 LWT Online
2020-07-15 12:18:37 LoadAvg 19
2020-07-15 10:13:50 Module Shelly2.5
2020-07-15 09:37:35 Modules1_0 Shelly2.5
2020-07-15 09:37:35 Modules1_1 Sonoff Basic
2020-07-15 09:37:35 Modules1_10 Sonoff Touch
2020-07-15 09:37:35 Modules1_11 Sonoff LED
2020-07-15 09:37:35 Modules1_12 1 Channel
2020-07-15 09:37:35 Modules1_13 4 Channel
2020-07-15 09:37:35 Modules1_19 Sonoff Dev
2020-07-15 09:37:35 Modules1_2 Sonoff RF
2020-07-15 09:37:35 Modules1_21 Sonoff SC
2020-07-15 09:37:35 Modules1_22 Sonoff BN-SZ
2020-07-15 09:37:35 Modules1_23 Sonoff 4CH Pro
2020-07-15 09:37:35 Modules1_25 Sonoff Bridge
2020-07-15 09:37:35 Modules1_26 Sonoff B1
2020-07-15 09:37:35 Modules1_28 Sonoff T1 1CH
2020-07-15 09:37:35 Modules1_29 Sonoff T1 2CH
2020-07-15 09:37:35 Modules1_3 Sonoff SV
2020-07-15 09:37:35 Modules1_30 Sonoff T1 3CH
2020-07-15 09:37:35 Modules1_39 Sonoff Dual R2
2020-07-15 09:37:35 Modules1_4 Sonoff TH
2020-07-15 09:37:35 Modules1_41 Sonoff S31
2020-07-15 09:37:35 Modules1_43 Sonoff Pow R2
2020-07-15 09:37:35 Modules1_44 Sonoff iFan02
2020-07-15 09:37:35 Modules1_5 Sonoff Dual
2020-07-15 09:37:35 Modules1_6 Sonoff Pow
2020-07-15 09:37:35 Modules1_7 Sonoff 4CH
2020-07-15 09:37:35 Modules1_70 Sonoff L1
2020-07-15 09:37:35 Modules1_71 Sonoff iFan03
2020-07-15 09:37:35 Modules1_74 Sonoff D1
2020-07-15 09:37:35 Modules1_8 Sonoff S2X
2020-07-15 09:37:35 Modules1_9 Slampher
2020-07-15 09:37:35 Modules2_14 Motor C/AC
2020-07-15 09:37:35 Modules2_15 ElectroDragon
2020-07-15 09:37:35 Modules2_16 EXS Relay(s)
2020-07-15 09:37:35 Modules2_17 WiOn
2020-07-15 09:37:35 Modules2_31 Supla Espablo
2020-07-15 09:37:35 Modules2_33 Yunshan Relay
2020-07-15 09:37:35 Modules2_35 Luani HVIO
2020-07-15 09:37:35 Modules2_45 BlitzWolf SHP
2020-07-15 09:37:35 Modules2_46 Shelly 1
2020-07-15 09:37:35 Modules2_47 Shelly 2
2020-07-15 09:37:35 Modules2_49 Neo Coolcam
2020-07-15 09:37:35 Modules2_50 ESP Switch
2020-07-15 09:37:35 Modules2_51 OBI Socket
2020-07-15 09:37:35 Modules2_52 Teckin
2020-07-15 09:37:35 Modules2_53 AplicWDP303075
2020-07-15 09:37:35 Modules2_54 Tuya MCU
2020-07-15 09:37:35 Modules2_55 Gosund SP1 v23
2020-07-15 09:37:35 Modules2_56 ARMTR Dimmer
2020-07-15 09:37:35 Modules2_57 SK03 Outdoor
2020-07-15 09:37:35 Modules2_58 PS-16-DZ
2020-07-15 09:37:35 Modules2_59 Teckin US
2020-07-15 09:37:35 Modules2_60 Manzoku strip
2020-07-15 09:37:35 Modules2_61 OBI Socket 2
2020-07-15 09:37:35 Modules2_63 Digoo DG-SP202
2020-07-15 09:37:35 Modules2_64 KA10
2020-07-15 09:37:35 Modules2_65 Luminea ZX2820
2020-07-15 09:37:35 Modules2_67 SP10
2020-07-15 09:37:35 Modules2_68 WAGA CHCZ02MB
2020-07-15 09:37:35 Modules2_72 EXS Dimmer
2020-07-15 09:37:35 Modules2_73 PWM Dimmer
2020-07-15 09:37:35 Modules3_18 Generic
2020-07-15 09:37:35 Modules3_20 H801
2020-07-15 09:37:35 Modules3_24 Huafan SS
2020-07-15 09:37:35 Modules3_27 AiLight
2020-07-15 09:37:35 Modules3_32 Witty Cloud
2020-07-15 09:37:35 Modules3_34 MagicHome
2020-07-15 09:37:35 Modules3_36 KMC 70011
2020-07-15 09:37:35 Modules3_37 Arilux LC01
2020-07-15 09:37:35 Modules3_38 Arilux LC11
2020-07-15 09:37:35 Modules3_40 Arilux LC06
2020-07-15 09:37:35 Modules3_42 Zengge WF017
2020-07-15 09:37:35 Modules3_48 Xiaomi Philips
2020-07-15 09:37:35 Modules3_62 YTF IR Bridge
2020-07-15 09:37:35 Modules3_69 SYF05
2020-07-15 12:18:37 MqttCount 1
2020-07-15 09:37:36 MqttLog 0
2020-07-15 09:37:36 NAME Shelly2.5
2020-07-15 09:37:36 PulseTime1_Remaining 0
2020-07-15 09:37:36 PulseTime1_Set 0
2020-07-15 09:37:36 PulseTime2_Remaining 0
2020-07-15 09:37:36 PulseTime2_Set 0
2020-07-15 09:37:36 PulseTime3_Remaining 0
2020-07-15 09:37:36 PulseTime3_Set 0
2020-07-15 09:37:36 PulseTime4_Remaining 0
2020-07-15 09:37:36 PulseTime4_Set 0
2020-07-15 09:37:36 PulseTime5_Remaining 0
2020-07-15 09:37:36 PulseTime5_Set 0
2020-07-15 09:37:36 PulseTime6_Remaining 0
2020-07-15 09:37:36 PulseTime6_Set 0
2020-07-15 09:37:36 PulseTime7_Remaining 0
2020-07-15 09:37:36 PulseTime7_Set 0
2020-07-15 09:37:36 PulseTime8_Remaining 0
2020-07-15 09:37:36 PulseTime8_Set 0
2020-07-15 10:13:50 RestartReason External System
2020-07-14 20:53:07 SaveData on
2020-07-14 20:53:07 SetOption26 on
2020-07-15 12:18:37 Sleep 50
2020-07-15 12:18:37 SleepMode Dynamic
2020-07-14 20:53:06 StateText1 off
2020-07-14 20:53:06 StateText2 on
2020-07-14 20:53:06 StateText3 toggle
2020-07-14 20:53:06 StateText4 hold
2020-07-15 12:18:38 Switch1 off
2020-07-15 12:18:38 Switch2 off
2020-07-15 09:37:36 SwitchDebounce 50
2020-07-15 12:18:38 TempUnit C
2020-07-15 12:18:38 Time 2020-07-15T11:18:37
2020-07-15 12:18:37 Uptime 0T02:04:52
2020-07-15 12:18:37 UptimeSec 7492
2020-07-15 10:13:50 Version 8.3.1(tasmota)
2020-07-15 10:13:50 WebServerMode Admin
2020-07-15 12:18:37 Wifi_AP 1
2020-07-15 12:18:37 Wifi_BSSId DC:39:6F:D2:FB:4A
2020-07-15 12:18:37 Wifi_Channel 11
2020-07-15 12:18:37 Wifi_Downtime 0T00:00:03
2020-07-15 12:18:37 Wifi_LinkCount 1
2020-07-15 12:18:37 Wifi_RSSI 52
2020-07-15 12:18:37 Wifi_SSId unten
2020-07-15 12:18:37 Wifi_Signal -74
2020-07-15 09:53:00 associatedWith Shelly_Reserve_CH2
2020-07-14 20:53:06 attrTemplateVersion 20200529
2020-07-15 11:44:59 state off
Attributes:
IODev MQTT_broker
autocreate 0
comment Channel 1 for MQTT2_DVES_FB10D7, see also MQTT2_DVES_FB10D7_CH2
devStateIcon {my $onl = ReadingsVal($name,"LWT","Offline") eq "Offline"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"ENERGY_Power_1","unknown");; my $total = ReadingsVal($name,"ENERGY_Total","unknown");; my $temp = ReadingsVal($name,"ANALOG_Temperature","-100");;"<a href=\"http://".ReadingsVal($name,"ip","none")." \"target=\"_blank\">".FW_makeImage($onl)."</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Verbrauch: $cons / Total: $total/ Temp: $temp °C</div>"}
icon hue_filled_outlet
jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 Dimmer:0 Channel_0:0 Channel_1:0 Channel_2:0 Channel_3:0 Channel_4:0 HSBColor:0 Color:0
model tasmota_2channel_split
readingList tele/tasmota_FB10D7/LWT:.* LWT
tele/tasmota_FB10D7/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }
tele/tasmota_FB10D7/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }
tele/tasmota_FB10D7/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }
tele/tasmota_FB10D7/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }
stat/tasmota_FB10D7/POWER1:.* state
stat/tasmota_FB10D7/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }
room MQTT2_DEVICE
setList off:noArg cmnd/tasmota_FB10D7/POWER1 0
on:noArg cmnd/tasmota_FB10D7/POWER1 1
toggle:noArg cmnd/tasmota_FB10D7/POWER1 2
setOtaUrl:textField cmnd/tasmota_FB10D7/OtaUrl $EVTPART1
upgrade:noArg cmnd/tasmota_FB10D7/upgrade 1
setStateList on off toggle
Die Json für tele/tasmota_FB10D7/SENSOR sieht so aus:
{"Time":"2020-07-15T10:46:07","Switch1":"off","Switch2":"off","ANALOG":{"Temperature":72.9},"ENERGY":{"TotalStartTime":"2020-07-14T18:35:50","Total":0.000,"Yesterday":0.000,"Today":0.000,"Period":0,"Power":[0,0],"ApparentPower":[0,0],"ReactivePower":[0,0],"Factor":[0.00,0.00],"Frequency":0,"Voltage":0,"Current":[0.000,0.000]},"TempUnit":"C"}
...auf die Gefahr hin, dass ich mit meiner Idee falsch liege...
(Jedenfalls afaik hat bisher noch keiner die Frage gestellt, weder nach dem, was json2nameValue() da mit solchen verschachtelten JSON macht, noch, wie sich ein Tasmota mit mehreren Energie-Mess-Funktionen sauber einbinden läßt.)
Für json2nameValue() gab es mal eine Diskussion um Wahrheitswerte, und das scheint mir nah' an des Pudels Kern zu liegen. Vermutlich interpretiert json2nameValue() den zweiten 0-Wert als reinen Wahrheitswert und verwirft das ganze dann (das müßte sich Rudi daher wohl mal näher ansehen). Dass 0.000 anders behandelt wird wie die (potentiell) boolsche Angabe, hast du ja gesehen.
Schickt man statt der puren 0 was anderes über den Äther, wird der JSON auch vollständig korrekt aufgelöst. Das hier
tele/tasmota_FB10D7/SENSOR {"Time":"2020-07-15T10:46:07","Switch1":"off","Switch2":"off","ANALOG":{"Temperature":72.9},"ENERGY":{"TotalStartTime":"2020-07-14T18:35:50","Total":0.000,"Yesterday":0.000,"Today":0.000,"Period":0,"Power":[3,4],"ApparentPower":[5,6],"ReactivePower":[7,8],"Factor":[0.00,0.00],"Frequency":0,"Voltage":0,"Current":[0.000,0.000]},"TempUnit":"C"}
ergibt dann auch die weiteren Readings.
(Leider kann ich auf die Schnelle nicht sagen, wie man json2nameValue ggf. ändern müßte, damit es auch mit der 2. "0" klarkommt).
(Irgendwie gefällt mir die Implementierung in der Shelly-firmware besser, "alles in einen JSON" zu pressen, kommt mir mittlerweile recht zwanghaft vor...)
Ist ein Bug beim Array-Parsen, habs gefixt und eingecheckt.
Wow, das ging schnell. Vielen Dank für eure Antworten und eure Hilfe!
:)
Thx. auch von meiner Seite.
@muma: Da vermutlich bald noch mehr mit dem Thema um's Eck kommen: kannst du mal versuchen, passende jsonMap-Attribute zu basteln, mit denen man dann die jeweiligen Kanalwerte auch nur am passenden Device anzeigt?
(Falls das zu kryptisch ist: einfach fragen!)
Dann kann ich versuchen, das zu vertemplaten...
Ergänzend: Das Ding sendet ja unglaublich viele (zumeinst unnötige) Infos... Hast du da was spezielles eingestellt? Oder eine Idee, wie man das (optimalerweise durch entsprechende Backlog-commands) wegbekommt?
Zitat@muma: Da vermutlich bald noch mehr mit dem Thema um's Eck kommen: kannst du mal versuchen, passende jsonMap-Attribute zu basteln, mit denen man dann die jeweiligen Kanalwerte auch nur am passenden Device anzeigt?
Ergänzend: Das Ding sendet ja unglaublich viele (zumeinst unnötige) Infos... Hast du da was spezielles eingestellt? Oder eine Idee, wie man das (optimalerweise durch entsprechende Backlog-commands) wegbekommt?
(Falls das zu kryptisch ist: einfach fragen!)
Also wenn ich das jetzt mittlerweile richtig verstanden habe müsste in der jsonMap jedes einzelne reading drin stehen, das man nicht sehen will. Also GPIO1:0 GPIO2:0 GPIO3:0 ...
Das ist aus meiner Sicht sehr aufwändig und auch Fehleranfällig. Wenn Tasmota mal mehr sendet (z.B. bei den Modules) kommt das wieder durcheinander. :-/
Habe auch nichts gefunden wie man Tasmota das Senden der Teile verbieten könnte. Daher ist denke ich auch das Backlog eine Sachgasse.
Schöner wäre es die Readings über eine Regex ausblenden zu können. Aber da bin ich dann erst mal überfragt :o
Genau, jsonMap funktioniert über eine 1:1-Zuordnung.
Vielleicht wäre es zielführender, (mind.) einen der INFO-Zweige (?) _nicht_ auszuwerten. Falls du nicht dazu kommst, schaue ich mir das bei Gelegenheit mal an, welche Art Messages eigentlich über welchen Zweig kommen. Das wird irgendwie immer umfangreicher, was da mit der ganzen GPIO-usw.-Konfiguration übermittelt wird, und eigentlich fängt man damit eher wenig an, oder?
Readings über regex zu löschen geht zwar, aber die kommen wieder, wenn was gesendet wird und produzieren dann auch entsprechende Events. (U.a.) das ist der Vorteil der jsonMap-Variante mit ":0"...
Also ich habe bei mir mal über den Tasmota Device Manager den unten angehängten Trace mitgeschnitten. INFO kommt da gar nicht vor :-\
Wie bist du denn auf INFO gekommen?
Ich versuche gerade in der Readingslist per Regex die ungewünschten ger nicht erst anzulegen. Klappt aber eher mäßig (bei meinen Regex Kenntinssen ;D). Was gehen würde, wäre nur einzelne RESULT Antworten anzulegen. Damit blende ich dann aber alle anderen RESULT aus, was denke ich zu Missverständnissen/Lücken führen könnte
[18:16:47] cmnd/tasmota_FB10D7/status 0
[18:16:47] cmnd/tasmota_FB10D7/template
[18:16:47] cmnd/tasmota_FB10D7/modules
[18:16:47] cmnd/tasmota_FB10D7/gpio
[18:16:47] cmnd/tasmota_FB10D7/gpios 255
[18:16:47] cmnd/tasmota_FB10D7/buttondebounce
[18:16:47] cmnd/tasmota_FB10D7/switchdebounce
[18:16:47] cmnd/tasmota_FB10D7/interlock
[18:16:47] cmnd/tasmota_FB10D7/blinktime
[18:16:47] cmnd/tasmota_FB10D7/blinkcount
[18:16:47] cmnd/tasmota_FB10D7/mqttlog
[18:16:47] cmnd/tasmota_FB10D7/pulsetime1
[18:16:47] cmnd/tasmota_FB10D7/pulsetime2
[18:16:47] cmnd/tasmota_FB10D7/pulsetime3
[18:16:47] cmnd/tasmota_FB10D7/pulsetime4
[18:16:47] cmnd/tasmota_FB10D7/pulsetime5
[18:16:47] cmnd/tasmota_FB10D7/pulsetime6
[18:16:47] cmnd/tasmota_FB10D7/pulsetime7
[18:16:47] cmnd/tasmota_FB10D7/pulsetime8
[18:16:47] stat/tasmota_FB10D7/STATUS {"Status":{"Module":0,"DeviceName":"Tasmota","FriendlyName":["Tasmota","Tasmota2"],"Topic":"tasmota_FB10D7","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
[18:16:47] stat/tasmota_FB10D7/STATUS1 {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://thehackbox.org/tasmota/release/tasmota.bin","RestartReason":"External System","Uptime":"0T00:20:16","StartupUTC":"2020-07-15T15:56:30","Sleep":50,"CfgHolder":4617,"BootCount":24,"BCResetTime":"2020-07-14T18:35:50","SaveCount":102,"SaveAddress":"F6000"}}
[18:16:47] stat/tasmota_FB10D7/STATUS2 {"StatusFWR":{"Version":"8.3.1(tasmota)","BuildDateTime":"2020-05-18T15:39:35","Boot":31,"Core":"2_7_1","SDK":"2.2.2-dev(38a443e)","Hardware":"ESP8266EX","CR":"357/699"}}
[18:16:47] stat/tasmota_FB10D7/STATUS3 {"StatusLOG":{"SerialLog":0,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["unten",""],"TelePeriod":30,"Resolution":"558180C0","SetOption":["04008009","2805C8000100060000005A00000000000000","00000000","00000000"]}}
[18:16:47] stat/tasmota_FB10D7/STATUS4 {"StatusMEM":{"ProgramSize":587,"Free":416,"Heap":25,"ProgramFlashSize":1024,"FlashSize":2048,"FlashChipId":"1540C8","FlashMode":3,"Features":["00000809","8FDAE797","043683A0","000000CD","010013C0","C000F981","00000024"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37","Sensors":"1,2,3,4,5,6"}}
[18:16:47] stat/tasmota_FB10D7/STATUS5 {"StatusNET":{"Hostname":"tasmota_FB10D7-4311","IPAddress":"192.168.0.201","Gateway":"192.168.0.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.0.1","Mac":"68:C6:3A:FB:10:D7","Webserver":2,"WifiConfig":4,"WifiPower":17.0}}
[18:16:47] stat/tasmota_FB10D7/STATUS6 {"StatusMQT":{"MqttHost":"192.168.0.44","MqttPort":1883,"MqttClientMask":"shellyswitch25_%06X","MqttClient":"shellyswitch25_FB10D7","MqttUser":"shellyswitch25_USER","MqttCount":1,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30}}
[18:16:47] stat/tasmota_FB10D7/STATUS7 {"StatusTIM":{"UTC":"2020-07-15T16:16:46","Local":"2020-07-15T17:16:46","StartDST":"2020-03-29T02:00:00","EndDST":"2020-10-25T03:00:00","Timezone":"+01:00","Sunrise":"05:03","Sunset":"20:48"}}
[18:16:47] stat/tasmota_FB10D7/STATUS9 {"StatusPTH":{"PowerDelta":0,"PowerLow":0,"PowerHigh":0,"VoltageLow":0,"VoltageHigh":0,"CurrentLow":0,"CurrentHigh":0}}
[18:16:47] stat/tasmota_FB10D7/STATUS10 {"StatusSNS":{"Time":"2020-07-15T17:16:46","Switch1":"off","Switch2":"off","ANALOG":{"Temperature":73.5},"ENERGY":{"TotalStartTime":"2020-07-14T18:35:50","Total":0.000,"Yesterday":0.000,"Today":0.000,"Power":[0,0],"ApparentPower":[0,0],"ReactivePower":[0,0],"Factor":[0.00,0.00],"Voltage":0,"Current":[0.000,0.000]},"TempUnit":"C"}}
[18:16:48] stat/tasmota_FB10D7/STATUS11 {"StatusSTS":{"Time":"2020-07-15T17:16:46","Uptime":"0T00:20:16","UptimeSec":1216,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"off","POWER2":"off","Wifi":{"AP":1,"SSId":"unten","BSSId":"DC:39:6F:D2:FB:4A","Channel":11,"RSSI":44,"Signal":-78,"LinkCount":1,"Downtime":"0T00:00:03"}}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"NAME":"Shelly2.5","GPIO":[56,255,17,255,21,83,255,255,6,82,5,22,156],"FLAG":2,"BASE":18}
[18:16:48] stat/tasmota_FB10D7/RESULT {"Modules1":{"0":"Shelly2.5","1":"Sonoff Basic","2":"Sonoff RF","4":"Sonoff TH","5":"Sonoff Dual","39":"Sonoff Dual R2","6":"Sonoff Pow","43":"Sonoff Pow R2","7":"Sonoff 4CH","23":"Sonoff 4CH Pro","41":"Sonoff S31","8":"Sonoff S2X","10":"Sonoff Touch","28":"Sonoff T1 1CH","29":"Sonoff T1 2CH","30":"Sonoff T1 3CH","74":"Sonoff D1","11":"Sonoff LED","22":"Sonoff BN-SZ","70":"Sonoff L1","26":"Sonoff B1","9":"Slampher","21":"Sonoff SC","44":"Sonoff iFan02","71":"Sonoff iFan03","25":"Sonoff Bridge","3":"Sonoff SV","19":"Sonoff Dev","12":"1 Channel","13":"4 Channel"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"Modules2":{"14":"Motor C/AC","15":"ElectroDragon","16":"EXS Relay(s)","31":"Supla Espablo","35":"Luani HVIO","33":"Yunshan Relay","17":"WiOn","46":"Shelly 1","47":"Shelly 2","45":"BlitzWolf SHP","52":"Teckin","59":"Teckin US","53":"AplicWDP303075","55":"Gosund SP1 v23","65":"Luminea ZX2820","57":"SK03 Outdoor","63":"Digoo DG-SP202","64":"KA10","67":"SP10","68":"WAGA CHCZ02MB","49":"Neo Coolcam","51":"OBI Socket","61":"OBI Socket 2","60":"Manzoku strip","50":"ESP Switch","54":"Tuya MCU","56":"ARMTR Dimmer","58":"PS-16-DZ","72":"EXS Dimmer","73":"PWM Dimmer"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"Modules3":{"20":"H801","34":"MagicHome","37":"Arilux LC01","40":"Arilux LC06","38":"Arilux LC11","42":"Zengge WF017","24":"Huafan SS","36":"KMC 70011","27":"AiLight","48":"Xiaomi Philips","69":"SYF05","62":"YTF IR Bridge","32":"Witty Cloud","18":"Generic"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"GPIO1":{"0":"None"},"GPIO3":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"GPIOs1":{"0":"None","17":"Button1","90":"Button1n","122":"Button1i","126":"Button1in","18":"Button2","91":"Button2n","123":"Button2i","127":"Button2in","19":"Button3","92":"Button3n","124":"Button3i","128":"Button3in","20":"Button4","93":"Button4n","125":"Button4i","129":"Button4in","9":"Switch1","82":"Switch1n","10":"Switch2","83":"Switch2n","11":"Switch3","84":"Switch3n","12":"Switch4","85":"Switch4n","13":"Switch5","86":"Switch5n","14":"Switch6","87":"Switch6n","15":"Switch7","88":"Switch7n","16":"Switch8","89":"Switch8n","21":"Relay1","29":"Relay1i"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"GPIOs2":{"22":"Relay2","30":"Relay2i","23":"Relay3","31":"Relay3i","24":"Relay4","32":"Relay4i","25":"Relay5","33":"Relay5i","26":"Relay6","34":"Relay6i","27":"Relay7","35":"Relay7i","28":"Relay8","36":"Relay8i","52":"Led1","56":"Led1i","53":"Led2","57":"Led2i","54":"Led3","58":"Led3i","55":"Led4","59":"Led4i","157":"LedLink","158":"LedLinki","37":"PWM1","46":"PWM1i","38":"PWM2","47":"PWM2i","39":"PWM3","48":"PWM3i","40":"PWM4","49":"PWM4i","41":"PWM5","50":"PWM5i","42":"Counter1","94":"Counter1n","43":"Counter2","95":"Counter2n","44":"Counter3"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"GPIOs3":{"96":"Counter3n","45":"Counter4","97":"Counter4n","160":"Buzzer","161":"Buzzeri","148":"Serial Tx","149":"Serial Rx","5":"I2C SCL","6":"I2C SDA","1":"DHT11","2":"AM2301","3":"SI7021","193":"DHT11o","4":"DS18x20","192":"DS18x20o","7":"WS2812","147":"ALux IrRcv","159":"ALux IrSel","143":"MY92x1 DI","144":"MY92x1 DCKI","140":"SM16716 CLK","141":"SM16716 DAT","142":"SM16716 PWR","180":"SM2135 Clk","181":"SM2135 Dat","107":"Tuya Tx","108":"Tuya Rx","183":"EXS Enable","201":"MOODL Tx","8":"IRsend","51":"IRrecv","130":"HLWBL SEL","131":"HLWBL SELi"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"GPIOs4":{"132":"HLWBL CF1","133":"HLW8012 CF","134":"BL0937 CF","156":"ADE7953 IRQ","145":"CSE7766 Tx","146":"CSE7766 Rx","135":"MCP39F5 Tx","136":"MCP39F5 Rx","137":"MCP39F5 Rst","62":"PZEM0XX Tx","63":"PZEM004 Rx","98":"PZEM016 Rx","99":"PZEM017 Rx","71":"SerBr Tx","72":"SerBr Rx","182":"DeepSleep"}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"ButtonDebounce":50}
[18:16:48] stat/tasmota_FB10D7/RESULT {"SwitchDebounce":50}
[18:16:48] stat/tasmota_FB10D7/RESULT {"Interlock":"off","Groups":"1,2"}
[18:16:48] stat/tasmota_FB10D7/RESULT {"BlinkTime":10}
[18:16:48] stat/tasmota_FB10D7/RESULT {"BlinkCount":10}
[18:16:48] stat/tasmota_FB10D7/RESULT {"MqttLog":0}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime1":{"Set":0,"Remaining":0}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime2":{"Set":0,"Remaining":0}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime3":{"Set":0,"Remaining":0}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime4":{"Set":0,"Remaining":0}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime5":{"Set":0,"Remaining":0}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime6":{"Set":0,"Remaining":0}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime7":{"Set":0,"Remaining":0}}
[18:16:48] stat/tasmota_FB10D7/RESULT {"PulseTime8":{"Set":0,"Remaining":0}}
[18:17:10] tele/tasmota_FB10D7/STATE {"Time":"2020-07-15T17:17:09","Uptime":"0T00:20:39","UptimeSec":1239,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"off","POWER2":"off","Wifi":{"AP":1,"SSId":"unten","BSSId":"DC:39:6F:D2:FB:4A","Channel":11,"RSSI":42,"Signal":-79,"LinkCount":1,"Downtime":"0T00:00:03"}}
[18:17:10] tele/tasmota_FB10D7/SENSOR {"Time":"2020-07-15T17:17:09","Switch1":"off","Switch2":"off","ANALOG":{"Temperature":73.5},"ENERGY":{"TotalStartTime":"2020-07-14T18:35:50","Total":0.000,"Yesterday":0.000,"Today":0.000,"Period":0,"Power":[0,0],"ApparentPower":[0,0],"ReactivePower":[0,0],"Factor":[0.00,0.00],"Voltage":0,"Current":[0.000,0.000]},"TempUnit":"C"}
[18:17:40] tele/tasmota_FB10D7/STATE {"Time":"2020-07-15T17:17:39","Uptime":"0T00:21:09","UptimeSec":1269,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"off","POWER2":"off","Wifi":{"AP":1,"SSId":"unten","BSSId":"DC:39:6F:D2:FB:4A","Channel":11,"RSSI":46,"Signal":-77,"LinkCount":1,"Downtime":"0T00:00:03"}}
[18:17:40] tele/tasmota_FB10D7/SENSOR {"Time":"2020-07-15T17:17:39","Switch1":"off","Switch2":"off","ANALOG":{"Temperature":73.5},"ENERGY":{"TotalStartTime":"2020-07-14T18:35:50","Total":0.000,"Yesterday":0.000,"Today":0.000,"Period":0,"Power":[0,0],"ApparentPower":[0,0],"ReactivePower":[0,0],"Factor":[0.00,0.00],"Voltage":0,"Current":[0.000,0.000]},"TempUnit":"C"}
[18:18:03] stat/tasmota_FB10D7/RESULT {"GPIO1":{"0":"None"},"GPIO3":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"}}
[18:18:10] tele/tasmota_FB10D7/STATE {"Time":"2020-07-15T17:18:09","Uptime":"0T00:21:39","UptimeSec":1299,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"off","POWER2":"off","Wifi":{"AP":1,"SSId":"unten","BSSId":"DC:39:6F:D2:FB:4A","Channel":11,"RSSI":38,"Signal":-81,"LinkCount":1,"Downtime":"0T00:00:03"}}
[18:18:10] tele/tasmota_FB10D7/SENSOR {"Time":"2020-07-15T17:18:09","Switch1":"off","Switch2":"off","ANALOG":{"Temperature":73.5},"ENERGY":{"TotalStartTime":"2020-07-14T18:35:50","Total":0.000,"Yesterday":0.000,"Today":0.000,"Period":0,"Power":[0,0],"ApparentPower":[0,0],"ReactivePower":[0,0],"Factor":[0.00,0.00],"Voltage":0,"Current":[0.000,0.000]},"TempUnit":"C"}
Hmm, INFO. steht halt noch in der readingList drin, und ich muß zugeben, dass ich mich mit dem Tasmota-Zeug nur kurz wirklich intensiver beschäftigt habe, das ist aber auch schon wieder einige Monate her (müßte noch eine 7-er Version gewesen sein). Kann gut sein, dass man da im Hinblick auf das, was heute Stand der Dinge ist, mal was anpassen muß...
Irgendwie habe ich den Verdacht, dass man vielleicht den ganze stat-Zweig ignorieren könnte?Ginge z.B. in readingList so:
stat/tasmota_FB10D7/STATUS.* {}
Müßte man aber näher prüfen, ob das zielführend ist...
(Die ersten paar Zeilen sind nur die subscriptions, nehme ich an?). Wäre evtl. geschickter, das "von außen" mit MQTT-Mitteln anzusehen (mosquitto_sub oä.); tendenziell sollte das auch mit raw-Events am IO+Event-Monitor gehen).
Ich habe jetzt mal einen ersten Schritt geschafft.
readinglist:
stat/tasmota_FB10D7/RESULT:\{\"(?!Modules)(?!GPIO)(?!PulseTime).* { json2nameValue($EVENT,'',$JSONMAP) }
jsonMap:
POWER1:0 POWER2:0 POWER3:0 POWER4:0 Dimmer:0 Channel_0:0 Channel_1:0 Channel_2:0 Channel_3:0 Channel_4:0 HSBColor:0 Color:0 GPIO_1:0 GPIO_2:0 GPIO_3:0 GPIO_4:0 GPIO_5:0 GPIO_6:0 GPIO_7:0 GPIO_8:0 GPIO_9:0 GPIO_10:0 GPIO_11:0 GPIO_12:0 GPIO_13:0
Damit fliegen dann mal die für mich nervigen Modules, GPIO und PulseTimer Infos raus. jsonMap ist noch notwendig, da in der selben RESULT message auch der Name zurück kommt und den fand ich hilfreich.
:) Das sieht schon mal gut aus.
Verkürzungsvorschlag:
stat/tasmota_FB10D7/RESULT:..(?!Modules|GPIO|PulseTime).* { json2nameValue($EVENT,'',$JSONMAP) }
Habe das template für mich mal angepasst und eine Version basic_less_readings und 2channel_spli_less_readings erfunden.
Dein Hinweis zur Verkürzung habe ich noch nicht aufgenommen, fühle mich besser wenn es explizit auf die {" verweist :o.
zusätzlich ist noch ein devStateIcon definiert (habe ich mir bei der Shelly abgeschaut) und daher auch zusätzliche Readings am CH2.
Ergebnis anbei, vielleicht kannst du ja darauf aufbauen.
Einen komischen Effekt habe ich noch, den ich mir nicht erklären kann, denke aber das liegt nicht am Template.
Bei einem Autocreate bekomme ich immer 2 Geräte angelegt. Einmal CID basierend auf der Definition MQTT client von Tasmota und einmal kryptisch mit einer UUID. Keine Ahnung wo das her kommt.
Ich habe json2nameValue mit einem optionalen (letzten) Parameter $filter erweitert.
Wenn gesetzt, muss der generierte Name diesen Parameter als Regexp matchen.
@muma:
Hmm, danke erst mal, da werde ich die Bruchstücke wohl selber etwas sortieren müssen (das "Grundtemplate" ist eigentlich ohne die Energie-Readings usw.).
CH2 dürfte so auch noch nicht passen, da muß wohl an der rL auch noch was gefeilt werden...
Nimm dir ruhig etwas Zeit, und im Ergebnis ist mir dann vermutlich mit den beiden funktionierenden RAW mehr geholfen, wie wenn ich mir die verteilten Änderungen zusammensuchen muß ;) .
Was das Phantomdevice angeht, habe ich keine so richtige Idee. Du verwendest als IO MQTT2_SERVER, oder?
@Rudi:
Wie immer: Danke!
Mal schauen, wann ich das wie einbauen kann (ist aber auch "na ja", dass da immer komplexere JSON-Strukturen gebastelt werden...)
OK, bei mir funktioniert das so, aber ich stecke ja auch nicht so tief drin wie ihr. Was genau stimmt denn aus deiner Sicht nicht?
Prinzipiell habe ich 2 neue Tempalte als Kopie der bestehenden angelegt um diese nicht zu beeinflussen (falls jemad die Volle Show an Infos doch haben möchte).
Geändert habe ich :
tasmota_basic_state_power1_less_readings
- name
- jsonMap
- readingList STATTOPIC/RESULT:
- devStateIcon
tasmota_2channel_split_less_readings
- name
- par:TELETOPIC;
- readingList TELETOPIC/LWT: TELETOPIC/SENSOR
- devStateIcon
- attr DEVICE,DEVICE_CH2 model
name:tasmota_basic_state_power1_less_readings
filter:TYPE=MQTT2_DEVICE
desc:Applies to Sonoff Basic, S20 using POWER1-topic for relay state <br>NOTE: The format the device is sending data will also be changed to lowercase!<br>NOTE: This template is intended to configure also channel one of multi-channel tasmota devices
order:A_01a
par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef }
par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef }
par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef }
par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 }
par:ICON;ICON as set, defaults to hue_filled_outlet;{ AttrVal("DEVICE","icon","hue_filled_outlet") }
attr DEVICE icon ICON
attr DEVICE jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 Dimmer:0 Channel_0:0 Channel_1:0 Channel_2:0 Channel_3:0 Channel_4:0 HSBColor:0 Color:0 GPIO_1:0 GPIO_2:0 GPIO_3:0 GPIO_4:0 GPIO_5:0 GPIO_6:0 GPIO_7:0 GPIO_8:0 GPIO_9:0 GPIO_10:0 GPIO_11:0 GPIO_12:0 GPIO_13:0
set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1
attr DEVICE setList \
off:noArg CMNDTOPIC/POWER1 0\
on:noArg CMNDTOPIC/POWER1 1\
toggle:noArg CMNDTOPIC/POWER1 2\
setOtaUrl:textField CMNDTOPIC/OtaUrl $EVTPART1\
upgrade:noArg CMNDTOPIC/upgrade 1
attr DEVICE readingList \
TELETOPIC/LWT:.* LWT\
TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\
TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\
TELETOPIC/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\
TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\
STATTOPIC/POWER1:.* state\
STATTOPIC/RESULT:\{\"(?!Modules)(?!GPIO)(?!PulseTime).* { json2nameValue($EVENT,'',$JSONMAP) }
deletereading -q DEVICE (?!associatedWith).*
attr DEVICE setStateList on off toggle
attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"LWT","Offline") eq "Offline"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"ENERGY_Power_1","unknown");; my $total = ReadingsVal($name,"ENERGY_Total","unknown");; my $temp = ReadingsVal($name,"ANALOG_Temperature","-100");;"<a href=\"http://".ReadingsVal($name,"ip","none")." \"target=\"_blank\">".FW_makeImage($onl)."</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Verbrauch: $cons W/ Total: $total/ Temp: $temp °C</div>"}
attr DEVICE comment NOTE: For on-for-timer SetExtensions are used. You may add on-for-timer option running on the device. The following is limited to 1h max duration, but will not affect future simple "on" commands:<br>on-for-timer {my $duration = $EVTPART1*10; 'cmnd/CMNDTOPIC/Backlog POWER1 1; delay '.$duration.'; POWER1 0'}<br>See the "Praxisbeispiele" in the wiki for "pulseTime1" alternative option and it's restrictions.
attr DEVICE autocreate 0
attr DEVICE model tasmota_basic_state_power1_less_readings
setreading DEVICE attrTemplateVersion 20200522 or prior
option:{ CALLSPEECHRECOGN }
set DEVICE attrTemplate speechcontrol_type_switch
# sonoff 2 channel device flashed with Tasmota and less readings.
name:tasmota_2channel_split_less_readings
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).*
desc:sonoff 2 channel device flashed with Tasmota and less readings. <br>NOTE: a second device will be created for the second channel
order:A_02
par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef }
par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef }
par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef }
par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 }
par:SETCHANNELINFO;Set this to 0 to not set any speech recogn. related attributes;{ 1 }
set DEVICE attrTemplate tasmota_basic_state_power1_less_readings \CALLSPEECHRECOGN=0
#attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2
#setreading DEVICE associatedWith DEVICE_CH2
copy DEVICE DEVICE_CH2
attr DEVICE_CH2 readingList \
TELETOPIC/LWT:.* LWT\
TELETOPIC/SENSOR.* { json2nameValue($EVENT,'',$JSONMAP) }\
STATTOPIC/POWER2:.* state
attr DEVICE_CH2 jsonMap POWER2:0 Dimmer:pct POWER1:0 Heap:0 LedTable:0 LoadAvg:0 MqttCount:0 SaveData:0 Scheme:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0
#attr DEVICE_CH2 comment Channel 2 for DEVICE
#setreading DEVICE_CH2 associatedWith DEVICE
attr DEVICE_CH2 setList \
off:noArg CMNDTOPIC/POWER2 0\
on:noArg CMNDTOPIC/POWER2 1\
toggle:noArg CMNDTOPIC/POWER2 2
attr DEVICE_CH2 setStateList on off toggle
attr DEVICE_CH2 devStateIcon {my $onl = ReadingsVal($name,"LWT","Offline") eq "Offline"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"ENERGY_Power_2","unknown");; my $total = ReadingsVal($name,"ENERGY_Total","unknown");; my $temp = ReadingsVal($name,"ANALOG_Temperature","-100");;"<a href=\"http://".ReadingsVal($name,"ip","none")." \"target=\"_blank\">".FW_makeImage($onl)."</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Verbrauch: $cons W/ Temp: $temp °C / $parent</div>"}
attr DEVICE,DEVICE_CH2 model tasmota_2channel_split_less_readings
setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20200529
option:{SETCHANNELINFO}
set DEVICE attrTemplate set_associatedWith \CHANNELS=2
option:{ CALLSPEECHRECOGN }
set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch
#set DEVICE_CH2 attrTemplate speechcontrol_type_switch
Hmm, vermutlich habe ich mich vorher in der langen file verirrt und das nicht auf's erste Mal überblickt ::) , das sieht soweit plausibel aus :) . Vermutlich fehlt nur das jsonMap-:0 in beiden Kanälen für die jeweils anderen Verbrauchswerte?
Muß insgesamt mal hirnen, wie man das organisieren kann und soll. Es gab auch mal einen "Tasmota-templates modularisieren"-Thread, den man evtl. dazu auch reaktivieren könnte. Mir ist z.B. im Moment nicht klar, ob man
- die INFO.-Zweige nicht rauswerfen kann;
- die STATUS\d+-Zweige nicht nennen, sollte, um die dann aktiv zu ignorieren...... und nicht jeder "will" die Ampel in jedem (Teil-) Device haben...
Weiter können wir m.E. gleich auch Rudi's neuestes feature mit einbauen?
(Sieht nach Aufwand auf, das alles). Wird wohl etwas dauern...