After reading through this link by “the-hook-up” and watching the video on this page, I decided to just use the rest API “binary_sensor”. This way I have HA send a “get” request to my “shelly-motion-sensor” every 5 seconds to get the status of the motion sensor. Its easily displayed in HA after you paste the below yaml into your config and restart HA.
I have included my yaml for the binary_sensor. All you have to do is just change the ip address to the correct ip address of your “shelly-motion-sensor”.
binary_sensor: ...
- platform: rest
resource: http://192.168.1.99/status
name: shelly motion
value_template: '{{ value_json.sensor["motion"]}}'
scan_interval: 5
device_class: motion
A quote from his page, “When I’m testing out my commands for a REST API, I like to use the chrome addon “advanced rest client” or ARC.”
To use it just paste this link https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo/related into your chrome browser and click “Launch app” in the top right corner. After you launch the app you can have a look at the retured “js” to include any thing else you might want to as a sensor as-well.
To do this, just set the mode to “GET” then set the url to "http://your-shelly-motion-sensor-ip-address/status. example http://192.168.33.1/status the video linked above explains it all. You can easily set it up to tell you the illumination, rssi and battery percentage info as-well. PS I turned off the cloud crap as-well using the ip address web interface of the shelly so it doesn’t even phone home.
Here are a few more sensors i made using this method. But in this case these yaml example are placed under the sensor section in your HA config not the binary_sensor section like the example above.
sensor:...
- platform: rest
resource: http://192.168.1.99/status
name: shelly motion
value_template: '{{ value_json.lux["value"]}}'
scan_interval: 5
device_class: illuminance
- platform: rest
resource: http://192.168.1.99/status
name: shelly motion
value_template: '{{ value_json.bat["value"]}}'
scan_interval: 5
device_class: battery
You can find the documentation for using the rest api at this link. https://www.home-assistant.io/integrations/rest/