(7:48) rad 11.5 / 10.6 manually turn on zone and burner
(8:11) rad 49.8 / 12.8
Why isn't MQTT Dash updating the icon status every few minutes?
Current Eir router LAN map
5C:CF:7F:40:CD:D0_Wireless 5C:CF:7F:40:CD:D0 192.168.1.100 Tony's Lamp (3536)
2C:3A:E8:07:B8:4F_Wireless 2C:3A:E8:07:B8:4F 192.168.1.103 Extension zone MV (6223)
2C:3A:E8:0F:4D:99_Wireless 2C:3A:E8:0F:4D:99 192.168.1.102 Cylinder MV (3481)
2C:3A:E8:0F:4C:E8_Wireless 2C:3A:E8:0F:4C:E8 192.168.1.101 Bedroom zone MV (3304)
EC:FA:BC:86:D5:E4_Wireless EC:FA:BC:86:D5:E4 192.168.1.108 Oil burner (5604)
2C:3A:E8:4F:4D:02_Wireless 2C:3A:E8:4F:4D:02 192.168.1.106 Living zone MV (3330)
5C:CF:7F:67:29:50_Wireless 5C:CF:7F:67:29:50 192.168.1.107 Shower pump (2384)
(8:11) rad 47.1 / 15.4 burner was off so put it back on
Currently, MQTT Dash is subscribing to "stat/sonoff_6223/POWER" which is "ON" or "OFF" but will only see last value.
But needs to subscribe to "tele/sonoff_6223/STATE" which is published every 5 mins (300 secs) as:
{"Time":"2019-04-14T08:42:33","Uptime":"0T11:33:24","Vcc":3.495,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"vodafone-2124","BSSId":"D0:FF:98:1B:31:3C","Channel":9,"RSSI":76}}
And to change this period on each sonoff to 5 secs. But what script will extract the "ON" field?
(8:49) rad 47.8 / 16.1 but my hands are still cold
(9:25) rad 30.9 / 16.1 (I was messing with MQTT Dash and turned off zone by accident)
Made all seven sonoff static IPs in Eir router (are lamp IP jumped after reboot!)
5C:CF:7F:40:CD:D0_Ethernet 5C:CF:7F:40:CD:D0 192.168.1.115 Tony's Lamp (3536)
2C:3A:E8:07:B8:4F_Wireless 2C:3A:E8:07:B8:4F 192.168.1.101 Extension zone MV (6223)
2C:3A:E8:0F:4D:99_Wireless 2C:3A:E8:0F:4D:99 192.168.1.116 Cylinder MV (3481)
2C:3A:E8:0F:4C:E8_Wireless 2C:3A:E8:0F:4C:E8 192.168.1.103 Bedroom zone MV (3304)
EC:FA:BC:86:D5:E4_Wireless EC:FA:BC:86:D5:E4 192.168.1.105 Oil burner (5604)
2C:3A:E8:4F:4D:02_Wireless 2C:3A:E8:4F:4D:02 192.168.1.106 Living zone MV (3330)
5C:CF:7F:67:29:50_Wireless 5C:CF:7F:67:29:50 192.168.1.107 Shower pump (2384)
(9:57) rad 32.0 / 16.2 (zone was off again!)
"event.payload" no good in "on receive" displays nothing!
"POWER" causes an error message which is something I suppose
"event[POWER]" same message
"print event" missing ; before statement
"print( event );" - print is not defined
"print event ;" missing ; before statement
"$" - $ is not defined
(14:36) rad 16.8 / 14.4
So a bit of a dilemna
So there are currently four ways to turn a sonoff on or off, say for my light
1) Using Node-Red by pointing a browser to: http://192.168.1.105:1880/ui
2) Pressing a MQTT Dash app button
3) Manually pressing the button on each unit
4) Point a browser to the IP address of a sonoff and clicking the"Toggle" button
They will each be done by or cause "ON" or "OFF" to be published to MQTT topic "cmnd/sonoff_3536/POWER". And on being actioned to "stat/sonoff_3536/POWER". If this is done with the "retained" flag set in all four cases then anybody launching the app or going to that website and subscribing to topic "stat/sonoff_3536/POWER" will instantly get the latest sonoff status.
Great write-up
http://www.thesmarthomehookup.com/end-random-ghost-switching-for-good-by-fixing-your-retain-settings-in-tasmota-and-home-assistant/
"switchretain on" using console resulted in:
15:27:04 CMD: switchretain on
15:27:04 MQT: stat/sonoff_3536/RESULT = {"SwitchRetain":"ON"}
"buttonretain on" ..
15:28:13 CMD: buttonretain on
15:28:13 MQT: stat/sonoff_3536/RESULT = {"ButtonRetain":"ON"}
"powerretain on"
15:28:54 CMD: powerretain on
15:28:54 MQT: stat/sonoff_3536/RESULT = {"PowerRetain":"ON"}
(16:22) 16.9 / 17.5 (using the electric fan heater)
Finally trying micro Python
https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html
http://micropython.org/download#esp8266
Flashed to board using NodeMcu PyFlasher (frontend for esptool.py)
Command: esptool.py --port COM8 --baud 115200 --after no_reset write_flash --flash_mode dio 0x00000 C:\Users\kilnageer\Documents\CoderDojo\2018 Reboot\CH Project\NodeMcu\esp8266-20190125-v1.10.bin --erase-all
http://micropython.org/webrepl/
(23:17) Two issues have come to light:
1) Some sonoffs drop LAN connection every few minutes (especially Extension Zone MV)
2) They don't restore their retained setting. A bug? Instead they restore the last one set by Node-Red.
So ensure that Node-Red is used to set the sonoffs. Otherwise their settings can change.
I'll investigate more tomorrow.
(8:11) rad 49.8 / 12.8
Why isn't MQTT Dash updating the icon status every few minutes?
Current Eir router LAN map
5C:CF:7F:40:CD:D0_Wireless 5C:CF:7F:40:CD:D0 192.168.1.100 Tony's Lamp (3536)
2C:3A:E8:07:B8:4F_Wireless 2C:3A:E8:07:B8:4F 192.168.1.103 Extension zone MV (6223)
2C:3A:E8:0F:4D:99_Wireless 2C:3A:E8:0F:4D:99 192.168.1.102 Cylinder MV (3481)
2C:3A:E8:0F:4C:E8_Wireless 2C:3A:E8:0F:4C:E8 192.168.1.101 Bedroom zone MV (3304)
EC:FA:BC:86:D5:E4_Wireless EC:FA:BC:86:D5:E4 192.168.1.108 Oil burner (5604)
2C:3A:E8:4F:4D:02_Wireless 2C:3A:E8:4F:4D:02 192.168.1.106 Living zone MV (3330)
5C:CF:7F:67:29:50_Wireless 5C:CF:7F:67:29:50 192.168.1.107 Shower pump (2384)
(8:11) rad 47.1 / 15.4 burner was off so put it back on
Currently, MQTT Dash is subscribing to "stat/sonoff_6223/POWER" which is "ON" or "OFF" but will only see last value.
But needs to subscribe to "tele/sonoff_6223/STATE" which is published every 5 mins (300 secs) as:
{"Time":"2019-04-14T08:42:33","Uptime":"0T11:33:24","Vcc":3.495,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"vodafone-2124","BSSId":"D0:FF:98:1B:31:3C","Channel":9,"RSSI":76}}
And to change this period on each sonoff to 5 secs. But what script will extract the "ON" field?
(8:49) rad 47.8 / 16.1 but my hands are still cold
(9:25) rad 30.9 / 16.1 (I was messing with MQTT Dash and turned off zone by accident)
Made all seven sonoff static IPs in Eir router (are lamp IP jumped after reboot!)
5C:CF:7F:40:CD:D0_Ethernet 5C:CF:7F:40:CD:D0 192.168.1.115 Tony's Lamp (3536)
2C:3A:E8:07:B8:4F_Wireless 2C:3A:E8:07:B8:4F 192.168.1.101 Extension zone MV (6223)
2C:3A:E8:0F:4D:99_Wireless 2C:3A:E8:0F:4D:99 192.168.1.116 Cylinder MV (3481)
2C:3A:E8:0F:4C:E8_Wireless 2C:3A:E8:0F:4C:E8 192.168.1.103 Bedroom zone MV (3304)
EC:FA:BC:86:D5:E4_Wireless EC:FA:BC:86:D5:E4 192.168.1.105 Oil burner (5604)
2C:3A:E8:4F:4D:02_Wireless 2C:3A:E8:4F:4D:02 192.168.1.106 Living zone MV (3330)
5C:CF:7F:67:29:50_Wireless 5C:CF:7F:67:29:50 192.168.1.107 Shower pump (2384)
(9:57) rad 32.0 / 16.2 (zone was off again!)
"event.payload" no good in "on receive" displays nothing!
"POWER" causes an error message which is something I suppose
"event[POWER]" same message
"print event" missing ; before statement
"print( event );" - print is not defined
"print event ;" missing ; before statement
"$" - $ is not defined
"@" missing name after @
"@.POWER" missing name after @
"@POWER" cannot read property "@"":POWER" from undefined
"val" is not defined
event
"@.POWER" missing name after @
"@POWER" cannot read property "@"":POWER" from undefined
"val" is not defined
event
(10:54) 49.2 / 18.2 turned zone off
(11:16)
event.payload = event.payload.split(',')[6].split(':')[1];
works for a text box
(14:36) rad 16.8 / 14.4
So a bit of a dilemna
So there are currently four ways to turn a sonoff on or off, say for my light
1) Using Node-Red by pointing a browser to: http://192.168.1.105:1880/ui
2) Pressing a MQTT Dash app button
3) Manually pressing the button on each unit
4) Point a browser to the IP address of a sonoff and clicking the"Toggle" button
They will each be done by or cause "ON" or "OFF" to be published to MQTT topic "cmnd/sonoff_3536/POWER". And on being actioned to "stat/sonoff_3536/POWER". If this is done with the "retained" flag set in all four cases then anybody launching the app or going to that website and subscribing to topic "stat/sonoff_3536/POWER" will instantly get the latest sonoff status.
Great write-up
http://www.thesmarthomehookup.com/end-random-ghost-switching-for-good-by-fixing-your-retain-settings-in-tasmota-and-home-assistant/
"switchretain on" using console resulted in:
15:27:04 CMD: switchretain on
15:27:04 MQT: stat/sonoff_3536/RESULT = {"SwitchRetain":"ON"}
"buttonretain on" ..
15:28:13 CMD: buttonretain on
15:28:13 MQT: stat/sonoff_3536/RESULT = {"ButtonRetain":"ON"}
"powerretain on"
15:28:54 CMD: powerretain on
15:28:54 MQT: stat/sonoff_3536/RESULT = {"PowerRetain":"ON"}
(16:22) 16.9 / 17.5 (using the electric fan heater)
Finally trying micro Python
https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html
http://micropython.org/download#esp8266
Flashed to board using NodeMcu PyFlasher (frontend for esptool.py)
Command: esptool.py --port COM8 --baud 115200 --after no_reset write_flash --flash_mode dio 0x00000 C:\Users\kilnageer\Documents\CoderDojo\2018 Reboot\CH Project\NodeMcu\esp8266-20190125-v1.10.bin --erase-all
Worked fine then reset board and used ESPlorer for UART window
MicroPython v1.10-8-g8b7039d7d on 2019-01-26; ESP module with ESP8266
Type "help()" for more information.
>>>
>>
help()
help()
Welcome to MicroPython!
For online docs please visit http://docs.micropython.org/en/latest/esp8266/ .
For diagnostic information to include in bug reports execute 'import port_diag'.
Basic WiFi configuration:
import network
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if.scan() # Scan for available access points
sta_if.connect("<AP_name>", "<password>") # Connect to an AP
sta_if.isconnected() # Check for successful connection
# Change name/password of ESP8266's AP:
ap_if = network.WLAN(network.AP_IF)
ap_if.config(essid="<AP_NAME>", authmode=network.AUTH_WPA_WPA2_PSK, password="<password>")
Control commands:
CTRL-A -- on a blank line, enter raw REPL mode
CTRL-B -- on a blank line, enter normal REPL mode
CTRL-C -- interrupt a running program
CTRL-D -- on a blank line, do a soft reset of the board
CTRL-E -- on a blank line, enter paste mode
For further help on a specific object, type help(obj)
>>>
Did above commands to connect
import network
import network
>>>
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
#6 ets_task(4020f4d0, 28, 3fff9e28, 10)
>>>
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
>>> sta_if.scan()
sta_if.scan()
[(b'vodafone-2124', b'\xe8\xab\xfa\xb0\xc4D', 1, -53, 3, 0)]
>>> sta_if.connect("vodafone-2124", PASSWORD )
sta_if.connect("vodafone-2124", PASSWORD )
>>> sta_if.isconnected()
sta_if.isconnected()
True
>>>
ESP_2871DF_Ethernet | EC:FA:BC:28:71:DF | 192.168.1.112 |
(23:17) Two issues have come to light:
1) Some sonoffs drop LAN connection every few minutes (especially Extension Zone MV)
2) They don't restore their retained setting. A bug? Instead they restore the last one set by Node-Red.
So ensure that Node-Red is used to set the sonoffs. Otherwise their settings can change.
I'll investigate more tomorrow.
No comments:
Post a Comment