To interact on the is_state a sensor sends I need to know the raw status codes. If you are more expercienced, can you tell me where I’ll find the raw code/name a sensor sends like sun.sun and above_horizon?
value_template: >-
{% if is_state('sun.sun', 'above_horizon') %}
Day
{% else %}
Night
{% endif %}
icon_template: >-
{% if is_state('sun.sun', 'above_horizon') %}
mdi:weather-sunny
{% else %}
mdi:weather-night
{% endif %}
As you will know a sensor sends the status and uses “sun-sun” or so. I only need to know which state name/text is used so I can fill in after if_state(…) in the democode above.
Sorry if I am not clear, English is not my native language. I have to fill in the status sent by the sensor on the dots to take further action. The problem is that I cannot find what I have to enter there, in other words, what exactly the sensor sends. That is why I am looking for a way to see which status messages a sensor sends.
No worries, English is also not my native language This depends on the sensor. For the sun integration the states are “above_horizon” and “below_horizon” as you can see here:
Maybe you can explain what you want to do and then I might be able to help you.
Thanks for understanding The sensor is a Philips Hue motion sensor, integrated in Hassio by using a so called integration. Therefor the settings are also no part of configuration.yaml by default.
Then you probably have a binary sensor something like binary_sensor.motion_sensor_batroom.
The possible states for a binary sensor are “on”, “off” or “unavailable”, where “on” means “motion” and “off” means no motion, as you can read in the below link.
Thanks for your help, everything works fine now. For those who have the same issue with Philips Hue motion detector, this is the working code in my config file:
Whew! This is a rather long thread to ultimately discover the goal was to translate a binary_sensor’s on/off states to beweging/geen beweging (movement/no movement).
Simply defining the device_class: device_class: motion
will cause the binary_sensor to display (in the UI) motion-related states (Detected/Clear as opposed to on/off). It will also change the appearance of the sensor’s icon.
If you don’t like Detected/Clear (or whatever the translation is for your native language) then you’ll need to create a Template Sensor to perform the conversion.
Yeah I’m not that good at understanding people’s requests
Once again you provided an easier solution, maybe I should just wait for your reply the next time I didn’t even think about this, was too focused on fixing the template.
All things considered, I think you did very well. It’s challenging, for everyone involved, when they must communicate in a non-native language. I can’t even imagine attempting to participate in a Dutch-language forum. I’d have to resort to using Google-translated messages … and that would hardly make things easier for native Dutch speakers to interpret my meaning.