thejeffreystone / hassio_addons

Apache License 2.0
45 stars 26 forks source link

sensor.generic_remote_last_seen #41

Closed kaiorurulad closed 1 year ago

kaiorurulad commented 1 year ago

Hi Jeffrey,

Not an issue but a question for a Newbie. I have your SDR2mqtt working great with my driveway alarm beam detectors that transmit on protocol 30. Home Assistant shows this sensor.generic_remote_driveway_announcer_last_seen on the Dashboard with a time value, which changes to 0 when I break the beam, perfect. The next step is to create a notification on my Android phone on the HA App, I think. I get stuck when attempting to create an automation, the "last_seen" Trigger/Sensor is not in the drop-down. What can I do to make "last_seen" show as Trigger to pick? Could you or someone explain how MQTT is creating/defining the Sensors?

image

image

Thank you.

Tom.

thejeffreystone commented 1 year ago

MQTT isn't so much doing anything. the RTL_433 project which this is using to do the heavy lifting on handles taking the information picked up by the SDR, decodes it, and sends it to MQTT. There is a mapping defined that tells it how to classify the information so Home Assistant can do auto discovery.

To create an automation you would need a template to leverage that last_seen right now. If you know what value it is (seconds?) I may be able to add it to the map file that tells home assistant what class to give it that makes it better. But as of right now HA thinks its a last seen time stamp (not likely if the value goes to zero) and you would have to use a template to do some time stamp math to leverage it as a trigger.

Easiest and quickest would be to create a template sensor that that reads that value and creates a generic sensor. Then you could be able to use it as the trigger, like when the state = 0.

kaiorurulad commented 1 year ago

Thanks Jeff. That's awesome advice. I have started playing with the Template Editor to work with the last seen timestamp output.

kaiorurulad commented 1 year ago

It turned out I just needed to pick State change when creating the Automation Trigger and use the last_seen entity MQTT already created. I was picking Device which still didn't show me the new binary sensor I created. Sorted now thanks.

kaiorurulad commented 1 year ago

It turned out I just needed to pick State change when creating the Automation Trigger and use the last_seen entity MQTT already created. I was picking Device which still didn't show me the new binary sensor I created. Sorted now thanks.