MQTT batterylevel reporting
-
Hi
I've migrated from serial to mqtt. With the serial connection I got the sensors to report the batterylevel, but I can't get it to work with the MQTT GW.
I've seen, that there's a "default" battery reporting line in MySensor.h
void sendBatteryLevel(uint8_t level, bool ack);But how do I adapt that to mqtt?
Can I just add the line at the end of the default temperature sensor loop?
-
Because I'm lazy at soldering I only have one battery board so far that actually reports battery level, but for me the battery is coming through as
MyMQTT/4/255/50 92Or whatever, "92" being the payload. I went into MyMQTT.cpp and changed the pertinent line to
char V_50[] PROGMEM = "BATTERY_LEVEL";So it looks a bit prettier and easier to catch in Python. As for actually using that value with some controller / HA software that is another matter. I myself save it as a "user variable" in Domoticz (since many of the dummy sensors in Domoticz can't have a battery level apparently). That way I can have a long list all in one place of all battery levels and can sort it.
What sort of controller do you use?
-
I'm using OpenHab as controller.
It worked pretty good when i had a raspberry as a serial gateway reporting to Openhab, but now I've switched to a MQTT gateway on an UNO. That works fine for a few temp sensors, but i'm having serious trouble getting a 8-channel relay node to work. It works for about 1-2 hours then it stops responding :( Then i have to powercycle it, to get it running again.
Currently the temp sensors report this:
0;0;3;0;9;read: 1-1-0 s=255,c=3,t=0,pt=1,l=1:81for a battery reading (81%).
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login