Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telemetry with Uptime only #4

Closed
jfrogg opened this issue Jan 29, 2017 · 16 comments
Closed

Telemetry with Uptime only #4

jfrogg opened this issue Jan 29, 2017 · 16 comments
Labels
enhancement Type - Enhancement that will be worked on help needed Action - Asking for help from the community

Comments

@jfrogg
Copy link

jfrogg commented Jan 29, 2017

TELEMETRY messages sent periodically are used to report various parameters in a single JSON.
Sometime, probably when the new hour of operation begins, TELEMETRY message is sent with only Uptime in the body.

The problem is: I'm using openHAB to extract a single parameter from TELEMETRY message by using jsonpath transformation. When message with Uptime only arrives this generates an error as there is no parameter of interest is present.
tele/sonoff1/TELEMETRY {"Time":"2017-01-29T19:59:17", "Uptime":2, "POWER":"OFF", "Wifi":{"AP":1, "SSID":"crazy", "RSSI":48}}
tele/sonoff1/TELEMETRY {"Time":"2017-01-29T20:02:30", "Uptime":3}
tele/sonoff1/TELEMETRY {"Time":"2017-01-29T20:04:23", "Uptime":3, "POWER":"OFF", "Wifi":{"AP":1, "SSID":"crazy", "RSSI":44}}

May I suggest to either send complete messages all the time or move Uptime to a separate topic?
Thanks!

@arendst
Copy link
Owner

arendst commented Jan 30, 2017

Can't you do some testing on the JSON fields you receive and want to act upon? In case of a Sonoff Pow you'll get two TELEMETRY messages with different fields so that would also be a problem in your case.

09:27:27 MQTT: tele/pow1/TELEMETRY = {"Time":"2017-01-30T09:27:27", "Uptime":17, "POWER":"OFF", "Wifi":{"AP":2, "SSID":"indebuurt2", "RSSI":100}}
09:27:27 MQTT: tele/pow1/TELEMETRY = {"Time":"2017-01-30T09:27:27", "Energy":{"Yesterday":"0.096", "Today":"0.000", "Period":0, "Power":0, "Factor":"0.00", "Voltage":0, "Current":"0.000"}}

@arendst arendst added the help needed Action - Asking for help from the community label Jan 30, 2017
@KPK75
Copy link

KPK75 commented Jan 30, 2017

I see the same issue in logs:

_tele/sonoff1/TELEMETRY = {"Time":"2017-01-30T10:02:30", "Uptime":1}
_tele/sonoff2/TELEMETRY = {"Time":"2017-01-30T10:02:30", "Uptime":1}
_tele/sonoff1/TELEMETRY = {"Time":"2017-01-30T10:12:11", "Uptime":1, "POWER":"OF...
_tele/sonoff2/TELEMETRY = {"Time":"2017-01-30T10:13:27", "Uptime":1, "POWER":"OF...

Uptime is sent on every hour at 2:30 and full status at TelePeriod time

@arendst
Copy link
Owner

arendst commented Jan 30, 2017

As designed. Even if teleperiod is 0 you'll receive the uptime message every hour as a kind of heartbeat to be used as trace information.

@klond
Copy link

klond commented Jan 30, 2017

This build will only support MQTT JSON messages in the future?

@jfrogg
Copy link
Author

jfrogg commented Jan 30, 2017

Additional filtering on the message content is absolutely possible. What I'm trying to promote is a "fixed data set per topic" approach. As a 2nd option I want to mention what is already in place for RESULT topic, where "Info1" and "Info2" are used to distinguish between 2 data sets.
I believe this will provide simpler and easier to parse output. Thanks to @arendst for all the efforts!

@arendst
Copy link
Owner

arendst commented Jan 30, 2017

@klond Yes, this build will only support MQTT JSON except for the power on/off which will also send messages like stat/sonoff/power ON to be able to use optional MQTT Retain.

@evilgreen The advantage of JSON is that a fixed dataset is not needed as all messages are labelled with their unique label. The telemetry data will change depending on what sensors you connect to your sonoff.

@klond
Copy link

klond commented Jan 30, 2017

@arendst Thanks for the information, I understand that JSON have alot of advantages .
I just need to find out how to convert/filter this in OpenHAB.
I could just imagine a OpenHAB binding around this :)

@jfrogg
Copy link
Author

jfrogg commented Jan 30, 2017

@arendst I see your point, but I still believe it's a bad idea to put everything in one basket. Feel free to close the issue.

@klond In opehHAB you will use the regular MQTT binding, configuration is straight forward. Please feel free to ask questions in OH community.

@arendst arendst closed this as completed Jan 30, 2017
@ThomDietrich
Copy link
Contributor

@klond https://github.com/arendst/Sonoff-Tasmota/wiki/openHAB

@klond
Copy link

klond commented Jan 31, 2017

@ThomDietrich Nice job, I was thinking the same.. If we could make some examples for each Sonoff product. Then it would be easier to deploy.

@ThomDietrich
Copy link
Contributor

@klond yes that would be really handy! If you'd like, join me in filling the wiki article as well as the community forum thread. I will add Sonoff Basic, Dual and Pow (hopefully) this evening.

@ThomDietrich
Copy link
Contributor

ThomDietrich commented Feb 2, 2017

@arendst I've encountered the "problem" you describe in your first answer. The first TELEMETRY message doesn't contain Power, the second doesn't contain RSSI. I'm parsing for both, seeing the same issues @evilgreen was seeing (using openHAB).

2017-02-02 23:16:14.756 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn't post update for 'WZ_Expedit_Power'
2017-02-02 23:16:14.794 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn't post update for 'WZ_Expedit_RSSI'

Now, Yes I agree json is great and further information for new sensors or similar can be added over time. I believe we all agree there.

Now we could blame openHAB... but it is doing the job just fine. It receives a message and "correctly" reports back NULL as a result of failure.

The problem is, that Sonoff-Tasmota sends different datasets in parallel on one MQTT topic. That seems error prone (as proven by openHAB, see above) and isn't really meaningful, because one of the big advantages of MQTT is, that you can define as many topics as you wish. You should seriously consider fixing the set of fields per topic. Topics could be "Status", "Uptime", "Energy", "Telemetry", ...

@arendst arendst reopened this Feb 3, 2017
@arendst arendst added the enhancement Type - Enhancement that will be worked on label Feb 3, 2017
arendst added a commit that referenced this issue Feb 4, 2017
3.9.11 20170204
* Fix command I2Cscan
* Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic
* Make all TELEMETRY, STATUS and COMMAND message topics unique (#4)
* Advertise command topic to be used by iobroker (#299)
* Fix butten (non)detection if no GPIO_KEY1 is defined (#13)
* Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars
(#18)
* Update web page with Build Date/Time, Emulation and mDNS Discovery and
Advertise information (#21)
arendst added a commit that referenced this issue Feb 4, 2017
3.9.11 20170204
* Fix command I2Cscan
* Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic
* Make all TELEMETRY, STATUS and COMMAND message topics unique (#4)
* Advertise command topic to be used by iobroker (#299)
* Fix butten (non)detection if no GPIO_KEY1 is defined (#13)
* Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars
(#18)
* Update web page with Build Date/Time, Emulation and mDNS Discovery and
Advertise information (#21)
@arendst
Copy link
Owner

arendst commented Feb 4, 2017

Version 3.9.11 makes a difference between hourly update and teleperiod information.

@ThomDietrich
Copy link
Contributor

ThomDietrich commented Feb 4, 2017

Thanks @arendst!
As always, great work ;) I've tested the new firmware with a Sonoff Pow and can confirm everything to work as expected. I'll update the wiki article on openHAB right away.

I think this issue can be closed but I can't speak for @evilgreen.

@jfrogg
Copy link
Author

jfrogg commented Feb 4, 2017

Thanks to @arendst for listening to his fans ;)
Yes, this issue can be closed as all seems to be more structured than before.
@ThomDietrich appreciate your contribution!

@PaulHam211
Copy link

I came on here to post the same issue, saw that it had been fixed, downloaded the new bin and uploaded over the air! Perfect. FIXED! 👍
Thank you.

arendst pushed a commit that referenced this issue Aug 21, 2018
update interlocking output to include the pair info
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
3.9.11 20170204
* Fix command I2Cscan
* Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic
* Make all TELEMETRY, STATUS and COMMAND message topics unique (arendst#4)
* Advertise command topic to be used by iobroker (arendst#299)
* Fix butten (non)detection if no GPIO_KEY1 is defined (arendst#13)
* Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars
(arendst#18)
* Update web page with Build Date/Time, Emulation and mDNS Discovery and
Advertise information (arendst#21)
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
3.9.11 20170204
* Fix command I2Cscan
* Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic
* Make all TELEMETRY, STATUS and COMMAND message topics unique (arendst#4)
* Advertise command topic to be used by iobroker (arendst#299)
* Fix butten (non)detection if no GPIO_KEY1 is defined (arendst#13)
* Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars
(arendst#18)
* Update web page with Build Date/Time, Emulation and mDNS Discovery and
Advertise information (arendst#21)
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 7, 2018
update interlocking output to include the pair info
arendst pushed a commit that referenced this issue Oct 1, 2018
arendst pushed a commit that referenced this issue Feb 8, 2019
arendst pushed a commit that referenced this issue Oct 6, 2019
@lalo-uy lalo-uy mentioned this issue Sep 5, 2020
15 tasks
arendst pushed a commit that referenced this issue Dec 23, 2020
mepunit added a commit to shivankittech/smart-home-base-firmware that referenced this issue Aug 18, 2021
GwangrokBaek referenced this issue in zigbang/Tasmota Aug 19, 2021
WebUI 스크립트 및 로직  추가
mepunit added a commit to shivankittech/smart-home-base-firmware that referenced this issue Aug 19, 2021
GwangrokBaek referenced this issue in zigbang/Tasmota Mar 31, 2022
WebUI 스크립트 및 로직  추가
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on help needed Action - Asking for help from the community
Projects
None yet
Development

No branches or pull requests

6 participants