Situation to date.
As a further test I cloned EmonESP from scratch.
This time everything went without hitch.
A couple of things I did note that might need to be addressed. The default MQTT IP address is correct for my setup but the default port is 65535. Also MQTT user defaulted to root with a password which of course was blanked so I can’t tell what it is.
However I was able to set my SSiD and MQTT parameters from the AP screen and MQTT connected almost immediately.
I then added $enable_UDP_broadcast = true; to settings.php.
I then ran update_emoncms.sh.
On first opening Inputs I could see no clock icons.
I did have the 2 old smartplug entries so I deleted them.
I think at this stage I rebooted emoncms. Still no clock items so I went into demandshaper screen and at that stage I got
Device on ip address 192.168.1.58 would like to connect
This is the sonoff so I allowed this and was able to set a schedule switch on and off and set the signal to Octopus.
At this point it went a bit pear shaped.
I think I had just reflashed the firmware on the 2 wemos ESPs I was using for test and went through the setting process again without hitch. They were appearing in inputs but with no clock icon.
At this point I reassembled the Sonoff and plugged into the mains. It did not reappear on inputs so I rebooted emoncms. This time no clock items and no smartplug2086 (the sonoff) but one of the Wemos.
Looking at the Sonoff webpage I noticed the MQTT port had changed back to 192.168.1.22 and MQTT was not connected. I corrected it to 192.168.1.28 and it reconnected.
My suspicion is that the eeprom writing of the ESP parameters has a bug. I haven’t got time to confirm this but I will try to test later.
One question. Does the sonoff MQTT Base-topic have to have a specific setting for demandshaper?
I think I have just proved there is a problem with the eeprom saving. I have had the same issue on a Wemos. However to be absolutely sure I will try this afternoon on a brand new Wemos just in case these issues are because the eeprom is not being cleared properly even though I always erase the ESPs before I upload new firmware.
The situation with emoncms is:-
I have one wemos smartplug showing in demandshaper with a clock icon and full control from the demandshaper window but this device is not actually powered or on the network.
I have the sonoff showing in Inputs with no clock icon.
I can connect to the sonoff directly via it’s URL and it is showing connected to MQTT. I can switch it On and Off from there. But I cannot access it from demandshaper window.
Any suggestions as to the best way forward? Do I need to delete the inputs to restore correct function?
I can confirm the ESPs are losing the URL and reverting to 192.168.1.22.
I have to enter correct URL and hit save to get them to show connected.
I also have a clue as to why no clock icons. I have just 2 smart plugs powered and connected. I get 4 smartplugs showing in inputs.
I think this is confusing emoncms. smartplug2086 and smartplug2516 are the correct names.
If I delete smartplug1 and smartplug2 via the inputs view the clock icons appear for smartplug2086 and smartplug2516 and I can control them from demandshaper.
If I then go back to inputs view smartplug1 and smartplug2 have shown up again but demandshaper still works as expected.
I have just set up a second Sonoff 20. There is something amiss with your naming routine as it came up as a duplicate to the first plug.
I also have confirmed that the MQTT parameters have to be reentered on every power up to connect to MQTT so they are not being saved properly.