xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
2.98k stars 635 forks source link

Uptime, config - mqtt and domoticz #85

Closed xoseperez closed 6 years ago

xoseperez commented 7 years ago

Originally reported by: f-fish (Bitbucket: f-fish, GitHub: Unknown)


Not sure what the performance impact would be.

1) With my growing number of espurna devices it is hard to say if they have had any funnies, resets etc Pushing the device uptime to domoticz as an example will allow one to track and alert on a device misbehaving so doing the calculation and allowing it to be published will help - maybe even add some point 2 magic.

2) For domoticz publish a configuration string.

Ideal information would be a custom string that would allow one to use any variable so build something like.

#!arduino

$HOSTNAME, $SERIAL_BAUDRATE, $EMBEDDED_WEB, $UPTIME

3) Allow for two IDX's to domoticz each with its own custom string a) on state change event, maybe mqtt connect, reconnect or WIFI change, reboot etc. b) timed publishing - say every 5 minutes

Not only will it help with tracking what version we are flashing when or what devices are doing, but with 3b you would be able to build in a status check-in to domoticz to report say $relayStatus or $UPTIME

Having a 3'd IDX on every hour would be an absolute bonus.

I will probably then push all my ESPURNA's data on the same IDX as device log.

Currently do this for my Pi's so that I can track and see if they are rebooting, what IP address they are coming up with etc - Domoticz data.

piyard.JPG

or in the case of a sonoff basic with espeasy uptime - I can see that R120 with a certain config was predictably "stable", but the last changes is causing some issues that need to be investigated.

espeasyuptime.JPG

Later Ferdie

xoseperez commented 6 years ago

Removing milestone: 1.8.3 (automated comment)

xoseperez commented 6 years ago

Pushed with 1.8.3.

xoseperez commented 7 years ago

Removing milestone: 1.8.1 (automated comment)

xoseperez commented 7 years ago

Removing milestone: 1.8.0 (automated comment)

xoseperez commented 7 years ago

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Flashed 1.6.8 ... some interesting mqtt messages send . fluxdb is an overkill for what I want to do with just plain logging. - So why not pretend the esp is a mysensor device?

https://www.mysensors.org/download/serial_api_20

Change your mqtt topic - 2017-03-02 03_49_41-SONOFF_95ED6A - ESPurna 1.6.8.png

Setup a mysensor mqtt dummy device on domoticz ..

and capture the Message bit of the events.

2017-03-02 03_48_42-Domoticz.png

No context on the values - but an out the box hack gets me some stuff that I wanted.

Later Ferdie

xoseperez commented 7 years ago

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Morning Xose I now realise the root topic is not the real issue, but rather the amount of data I need to get from mqtt as single events - I have opened a separate proposal see #90 .

Have a good week.

Later Ferdie

xoseperez commented 7 years ago

You can define whatever topic root you wish from the web interface.

xoseperez commented 7 years ago

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Ok I can get both mqtt /test/switch/# value string and domoticz/# json into influxdb via telegraf, next to do some graphing.

Later Ferdie

BTW ESPURNA's mqtt starting with a "/" tripped me up for a while.

xoseperez commented 7 years ago

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


ah wait you are way ahead of the curve ... see mqtt is doing the 5 minute thing already, very cool.

#!arduino

[MAIN] Time: 04:38:45 26/02/2017
[MAIN] Uptime: 300 seconds
[MAIN] Free heap: 28800 bytes
[MQTT] Sending /test/switch/SONOFF_95ED6A/status => 1
[MQTT] Sending /test/switch/SONOFF_95ED6A/ip => 192.168.1.22
[MQTT] Sending /test/switch/SONOFF_95ED6A/uptime => 300
[MQTT] Sending /test/switch/SONOFF_95ED6A/freeheap => 28800
[BEAT] Power: 3311 mV
[MQTT] Sending /test/switch/SONOFF_95ED6A/vcc => 3317
[DS18B20] Temperature:  21.5ºC
[MQTT] Sending /test/switch/SONOFF_95ED6A/temperature =>  21.5

[WEBSOCKET] Broadcasting '{"dsVisible": 1, "dsTmp":  21.5, "tmpUnits": 0}'
[DS18B20] Temperature:  21.5ºC
[MQTT] Sending /test/switch/SONOFF_95ED6A/temperature =>  21.5
[WEBSOCKET] Broadcasting '{"dsVisible": 1, "dsTmp":  21.5, "tmpUnits": 0}'
[DS18B20] Temperature:  21.5ºC
[MQTT] Sending /test/switch/SONOFF_95ED6A/temperature =>  21.5
[WEBSOCKET] Broadcasting '{"dsVisible": 1, "dsTmp":  21.5, "tmpUnits": 0}'
[DS18B20] Temperature:  21.5ºC
[MQTT] Sending /test/switch/SONOFF_95ED6A/temperature =>  21.5
[WEBSOCKET] Broadcasting '{"dsVisible": 1, "dsTmp":  21.5, "tmpUnits": 0}'
[DS18B20] Temperature:  21.5ºC
[MQTT] Sending /test/switch/SONOFF_95ED6A/temperature =>  21.5
[WEBSOCKET] Broadcasting '{"dsVisible": 1, "dsTmp":  21.5, "tmpUnits": 0}'
[MAIN] Time: 04:43:45 26/02/2017
[MAIN] Uptime: 600 seconds
[MAIN] Free heap: 28776 bytes
[MQTT] Sending /test/switch/SONOFF_95ED6A/status => 1
[MQTT] Sending /test/switch/SONOFF_95ED6A/ip => 192.168.1.22
[MQTT] Sending /test/switch/SONOFF_95ED6A/uptime => 600
[MQTT] Sending /test/switch/SONOFF_95ED6A/freeheap => 28776
[BEAT] Power: 3312 mV
[MQTT] Sending /test/switch/SONOFF_95ED6A/vcc => 3315
[DS18B20] Temperature:  21.6ºC
xoseperez commented 7 years ago

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


#!arduino

[MAIN] Uptime: 0 seconds
[MAIN] Free heap: 29792 bytes
[BEAT] Power: 3256 mV
[DS18B20] Temperature:  21.4ºC

Oh wow ... thanks thanks thanks ... now I have to up my game and get my influxdb going.

If you are considering doing a log line style reporting to domoticz, Please add {identifier} in to the mix, that way we do not have to worry about dhcp'ed ip changing and can have multiple device logging to a single test device.

I think an uptime idx for domotics that goes to a custom sensor every x minutes and a concatenation of system logging information to the text device on a different idx on major events like boot, reset, reconnect (maybe add ssid name or logging) and mqtt connect.

Later Ferdie

xoseperez commented 7 years ago

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


For the two examples above Text and Custom Sensor.

Later Ferdie

xoseperez commented 7 years ago

One question, what kind of device are you using in Domoticz to report this data to? Or is it a log message?

xoseperez commented 7 years ago

Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown):


Cool, glad the idea has some merit.

Not too stuck on what needs to be published .. but time up time in minutes will work well. Hostname is useful when you are DHCP to find your device. My example was more about how the use can configure what ever they wanted, but at compile time one could play around if the basic mechanism is in-place.

Later Ferdie

xoseperez commented 7 years ago

I agree publishing some health information about the device could be great. Right now it's only reporting if the device is alive every 5 minutes and IP and version upon boot. Adding a status update of some interesting data every 5 minutes could be a first approach and not hard to do at all. I don't see the need to report the hostname, baudrate or embedded_web settings (maybe it was just an example), but things I do think are interesting are: