Hi
I’m trying to get presence data from my 3 Hue motion sensors into Home Assistant. I’m not sure what the best way is to get in or the best way to hold it in HA.
I’m sending it via MQTT to an input_slider, but I can’t get it to work. I’m using this example, Setting input_slider value from mqtt topic
Tried both variation.
sensor:
- platform: mqtt
state_topic: ‘wc/motion/presence/’
name: ‘wc_motion’
value_template: ‘{{ value.state }}’ #value_template: ‘{{ value_json.state }}’
I know the MQTT broker works. I can see the data on phone and tablet, both change right away. I tried sending with or without decimal "2, “2.2”, or “2,2”.
I get the error: [homeassistant.core] Invalid service data for input_slider.select_value: expected float for dictionary value @ data['value']. Got ''
Second question. The Hue Motion sensors also got temperature data i want to display. What is the best way to display a decimal integer? Can something be used a a text box or similar?
Hi
Thanks for reply. I used sliders, because i had another example i tried to get working. But the sensors is more simple, so that’s perfect.
Real time data isn’t important to me. I’m interested in how many hours since a sensor registered any motion. I haven’t used HA long. My original plan is to get the data from the Hue sensors with a Python script and let the script parse to HA that its 5 hours since any motion. You tried to used the Home Assistants History for checking how many hours its been since something?
If you want to use Python with HA I strongly suggest you check out Appdaemon.
Writing an appdaemon app that does something after five hours of no motion is relatively simple
import appdaemon.appapi as appapi
class motion_app(appapi.AppDaemon):
def initialize(self):
# Listens for 'motion_sensor' to be in state 'off'' for 5 hours,
# then calls method 'motion_stopped'
self.listen_state(self.motion_stopped, binary_sensor.motion_sensor],
new = "off",
duration = 5*60*60)
def motion_stopped(self, entity, attribtute, old, new, kwargs):
# Do whatever you need here