So I’ve put following code in my config.yaml but I’ve got a couple of switches that really are door-magnets - can I put them in here and see if they are open or closed? I also have a motionsensor - can I get it in here and get use of it or do I think wrong here?
binary_sensor:
- platform: template
sensors:
movement:
device_class: motion
value_template: "{{ is_state('switch.movement', 'on') }}"
door:
device_class: opening
value_template: "{{ is_state('switch.door', 'on') }}"
the enteties I’d like to add
switch.motion_sensor_downstairs
switch.teknikrummet_door
switch.tvattstuga_door
I hope someone can guide me = )
Are you polling the sensors over MQTT? If so, use the MQTT Binary Sensor component and specify the device class there with payload on and off.
Below is a simple example I use for a water sensor monitoring my sump pump
- platform: mqtt
state_topic: "/basement/Water 2/Water 2"
payload_off: "0"
payload_on: "1"
qos: 0
name: Basement floor
device_class: moisture
I guess I’m not doing that. Should I use mqtt do you think? I use mqtt for device-tracking and I’m pretty new to this but think it’s great fun and I try to learn as much as possible.
Is that all you put into the config-file?
What switches are you using? Are they simple reed switches hooked up to an ESP8266 or a kit you bought?
it’s Telldus-switches that I’ve added to my HASS
Sorry I have no experience with Telldus, but have you seen this component?
Yes - that’s what I’ve been using and that works great. The problem is that the door-magnets appear as switches when I really want them to show up as open or closed.
Can you take a screenshot of your frontend? What state shows up for those switches, on and off?
If so, just replace the “switch.movement” with “switch.teknikrummet_door” etc.
binary_sensor:
- platform: template
sensors:
movement:
device_class: motion
value_template: "{{ is_state('switch.motion_sensor_downstairs', 'on') }}"
door:
device_class: opening
value_template: "{{ is_state('switch.teknikrummete_door', 'on') }}"
This is how it look now, I’d like the switches to go to the second picture and there report movement and open/closed doors
I think what you’re saying is you want the same name for the sensor version as the switch, correct?
So instead of “door” you want “teknikrummet door”, etc? Are the sensors not reporting their respective actions?
Sorry, my German skills ended my senior year of high school
keithh666
(Keith Hull)
November 22, 2017, 6:05pm
11
Maybe you can do something like this…
rfl_kitchendoor_state:
value_template: '{% if is_state("switch.rfl_kitchen_door", "on") %}open{% else %}closed{% endif %}'
friendly_name: 'RFL KitchenDoor State'
Then hide the original
do replace existing code or do I add that below my existing code? Sorry for being such noob…
keithh666
(Keith Hull)
November 22, 2017, 6:41pm
13
That comes from my sensors.yaml so you would put it under sensor: then hide the original switch in customise. And add the new state sensor to the appropriate group.
Well not really.but yes in some way.
I’d like to see if each door is open or closed,-now it’s just a black or yellow lightning so to say.
It’s swedish - my german is no good neither.
Well that’s why it wasn’t translating
You can definitely add the template sensor @keithh666 showed above and hide the switches. There are a few ways you can do what you’re looking for.