bart
(bart)
1
Hi,
I have a rx/tx reciever/sender on my beagle bone black. Via a python-script I get the messages from the 433mhz receiver on mqtt.
my pir movement sensor sends the signal : 010101010101010100000000
every time when there is movement.
I know the state_topic, which is: "ninjaCape/input/11
But how do I get this sensor in hass?
I really like to automate my hue lights in my house, using the information from the movement sensors.
can someone help me?
palitu
2
try something like this, use a template to modify the input to something useful.
Someone please fix up my template - as i am new to writing them, and i am sure i got it wrong.
sensor:
platform: mqtt
state_topic: "ninjaCape/input/11"
name: "Movement Sensor"
value_template: '{% if value == 010101010101010100000000 %} On {% else %} Off {% endif %}'
check here for more details:
http://jinja.pocoo.org/docs/dev/templates/#if
1 Like
bart
(bart)
3
hi palitu, thanks for your help!
I tried your idee but didn’t work out.
Now I have this:
binary_sensor:
platform: mqtt
state_topic: “ninjaCape/input/11”
name: “beweging-hal”
qos: 0
payload_on: “010101010101010100000000”
payload_off: “beweging-hal-uit”
sensor_class: movement
automation:
alias: ‘beweging-hal-uit-2m’
trigger:
- platform: state
entity_id: binary_sensor.beweginghal
state: ‘on’
condition: use_trigger_values
action:
service: “mqtt.publish”
data_template:
topic: “ninjaCape/input/11”
retain: “false”
payload: ‘beweging-hal-uit’
and this works.
The thing I like to ad, but I can’t get it done, is to ad a delay before the mqtt message is published.
Now I am going to try to make a hue bulb burn for 4 minutes, when there is movement and the sun is going down in one hour.
palitu
4
cool!
I learnt something too, and thanks for posting the solution.
look at the example automation or scripts page on how to do a timer.