iMicknl / ha-nest-protect

Nest Protect integration for Home Assistant. This will allow you to integrate your smoke, heat, co and occupancy status real-time in HA.
MIT License
315 stars 56 forks source link

Expose `Warning` status for Smoke / CO #56

Open iMicknl opened 2 years ago

iMicknl commented 2 years ago

Description

Smoke Status is currently a binary sensor (off = OK, on = Emergency). However, Nest Protect also offers a 'Warning' status.

My preference is to keep the binary sensors, since Home Assistant only has the CO/Smoke/Heat device classes for a binary sensor and many automations are based on binary sensors.

Perhaps we can add a separate (text) sensor that shows the state (OK, Warning, Emergency).

Device (optional)

No response

Additional information

No response

mdegat01 commented 2 years ago

This might be worth an architecture discussion if we can find a few other examples. I'm familiar with this situation from Nest Protects but I've had other Smoke/CO detectors in the past with the same idea. Like when I've lived in apartment complexes the smoke detectors all had this kind of state transition:

1) Idle - Nothing is wrong 2) Warning - Yours (and only yours) are beeping. Open some windows quick before... 3) Emergency - All detectors in the building go off, everyone out.

I wouldn't surprised if lots of other smoke detectors have this as well. And to your point there really isn't a good way to represent this in HA right now. Your best bad options are a sensor without a device-class and documentation to tell people about the states to expect or multiple binary sensors (one for emergency and one for warning) for each monitored condition.

mdegat01 commented 2 years ago

I popped onto Zigbee2MQTT for some research since they have that great supported devices page. Obviously not a comprehensive source but they do have a lot of supported devices.

Found a few with a similar idea, a warning attribute. It's a bit broader then this use case but I believe Z2M is doing the aggregation not necessarily the device since it specifies that the attribute is a composite:

I also noticed what others do is expose a reading of the actual measurement of CO or Smoke which basically allows you to decide what's a warning and what's an emergency. The TuYa and Xiaomi devices I found in these categories seem to take this approach:

TuYa and Xiaomi are some pretty popular brands so perhaps that's the more common way? It does work better with HA and wouldn't be the first time Nest took a different approach from others (ex. Battery health vs. Battery level).

Although I actually like Nest's approach better here since it doesn't require me to research what an unsafe level of CO and Smoke is. The battery health thing annoyed me because everyone knows batteries but I have no idea what is an unsafe level of CO or Smoke (or even what the typical unit of measurement is lol).

gminco commented 2 years ago

I like the idea of having the 3 states, what would be the downside of having smoke/co/heat both as binary_sensor and as sensor (with the 3 states)?

kdknigga commented 2 years ago

Just out of curiosity, does "warning" currently get lumped in with "ok", or "emergency"?

iMicknl commented 2 years ago

Just out of curiosity, does "warning" currently get lumped in with "ok", or "emergency"?

Currently with 'off', thus 'clear'.

kdknigga commented 2 years ago

Thanks!

iMicknl commented 2 years ago

Would someone be able to trigger the warning (and emergency status) and gather diagnostics at that point? I assumed that they are using 1 / 2 / 3, however in my latest tests it seems they start at 0... Would be good to understand if the main functionality of this integration is actually working.

kdknigga commented 2 years ago

Just "Download diagnostics" and send the resulting text file after a smoke detection event?

iMicknl commented 2 years ago

@kdknigga yes! And if possible, also if you first get a warning message.

kdknigga commented 2 years ago

I just ordered some smoke detector tester, so I can try it out when it arrives.

kdknigga commented 2 years ago

config_entry-nest_protect-e9c8b4f31b1b8ac2cfccff6f09ca939b_alarm.json.txt config_entry-nest_protect-e9c8b4f31b1b8ac2cfccff6f09ca939b_headsup.json.txt

The detector went from "Heads-up" to "Alarm" very quickly with the tester spray, but I think I managed to get diagnostics dumps for each state. Certainly "smoke_status" is different between the two.

kdknigga commented 2 years ago

Also:

image

willrutherford commented 1 year ago

Any update on this? Having the ability to turn on fans and open windows before reaching an audible alarm state would be excellent!

philbert2k commented 1 year ago

Also very interested in this one...