Closed vworp closed 6 months ago
Quite right, @vworp. Sensors were broken for the lighting app.
Committed a change to use /level instead for all sensor types, whether lighting, user param or measurement. It makes far more sense to be consistent.
You might like to kill off the cbus/read/ topics using MQTT explorer to clean up the old /state topics for user params/unit params/measurement if you use those. No harm leaving them there, but if you're like me then I know that you will. 😉
Let me know how you go.
(And also a commit to be able to use decimal and scale adjustments with lighting group sensors.)
A sensor value from a lighting group is going to be exposed as a number, so you probably want to add dec=0 to the keywords. (Actually I'm going to implement no decimals by default for lighting group sensors, as that makes sense for all cases where a scale= keyword is not used.) - default of zero decimals for lighting group is committed.
But a follow-up question for you, @vworp.
How will this be used in HA? Do you want a number? Or would you prefer to see text like 'Armed', 'Disarmed', etc.?
If text would be more helpful (i.e. you're not using the sensor in HA automations), then I could implement something like 'translate=0:Disarmed/1:Armed/2:Some other state'
I added the capability to display a lighting group sensor as text anyway, @vworp, using a lvl= keyword.
MQTT, sensor, sa=Family room, pn=Alarm state, lvl=Disarmed:0/Armed:1,
For me, in HA, I'll probably be using just the number. I do like the idea of translating the number to readable text though, so I'll probably mess with both for a while until I'm told to stop breaking things. I think I'm afk for a couple of days, but I should be able to try this out by the weekend
Oh please tell me you'll be asking Google or Alexa the state of the alarm over and over, with your significant other listening with more than a roll-eyes... ("But, It's IMPORTANT, darling...")
Essentially, yes :) I, accidentally, utterly destroyed any Alexa commands that worked a few weeks ago. She's not amused, it's on my list to fix. She's moderately pleased that she can turn lamps on and off again now.
I've had a mess around, and sensors are now reporting levels correctly and the level to text looks like it's working perfectly. I didn't even know I wanted that feature, but now it's there, I do :)
Brilliant, @vworp. Thanks!
Not sure if this is working as intended:- I have a group address under the lighting application, which sets a level based upon what the current security mode is. (I don't know why I did it this way, it was a while ago). If I define this as :- MQTT, sensor, pn=SecurityMode I get a sensor device in Home Assistant. When I change security modes, I can see a MQTT message with the correct level being sent out with an additional STATE value. Looks like Home Assistant is only tracking the STATE value in the payload.