MQTT Sensor monitoring with notify

Hi Guys, this is my first post. I’m using Home assistant with arduino board with mysensors library. I’m using arduino nano with ethernet shield and nrf24l01 module like a gateway, and arduino mini pro with nrf24l01 module like a node. Communication between arduino node/gateway and homeassistant using mqtt protocol. Actually i have some sensors (temperature, humidity ecc) connected to arduino node. Home assistant work correctly and i can see temperature, umidity ecc values in frontend. This is what I would like:

  • Monitoring node and sensor connected to it and send notify if there’s a problem .At this time, if i shutting down arduino node, home assistant leave the last read values in frontend.
  • Monitoring gateway and send notify if gateway will be unreacheable. I tried with ubus device tracker (i’ve openwrt router), but i think that home assistant search only mac adresses in wireless router interface. For my android phone, ubus device tracker works correctly.
    Do you have some idea how can i make it possible?

Someone can help me?

This sensor’s example shows a way to check if a device is up and running.

I tried your solution but everytime i’ve the binary_sensor in off state.
I used this configuration:

  - platform: command_line
    name: gwhome_mon
    command: 'ping -c 1 192.168.x.x | grep "1 received" | wc -l'
    payload_on: 1
    payload_off: 0

sensor state:

{"attributes": {"friendly_name": "gwhome_mon"}, "entity_id": "binary_sensor.gwhome_mon", "last_changed": "2016-06-23T16:24:53.860569+00:00", "last_updated": "2016-06-23T16:24:53.860569+00:00", "state": "off"}

I tried with ping command inside a shell script, but with the same result! Why sensor don’t change the state?

fabaff: starting fromyour example link, with some correction, now works fine. This is my binary sensor configuration:

  - platform: command_line
    name: gwhome_mon
    command: 'ping -c 1 192.168.x.x | grep "1 received" | wc -l'
    sensor_class: opening
    payload_on: "1"
    payload_off: "0"

Thanks for the info!!

1 Like