Hello, new Home Assistant user here. First of all, thanks to the whole community for maintaining such a brilliant home automation platform!
Then to my problem:
I’m running hass.io on Raspberry Pi 3+ on two different setups (connected on the same LAN), and I’d like to read input_select / sensor data with the 1st RPi from the 2nd RPi. I’ve tried to accomplish this first via mqtt, and now with REST API / RESTful Sensor. I had to convert my “input_select” to “sensor” (both outputting states: S1/S2/S3/S4), because I couldn’t figure out how to create “REST input select”
This is the error I’m getting:
{“message”: “Invalid JSON specified.”}
Sensor State should read S1, S2, S3 or S4.
I couldn’t find proper instructions how to configure RESTful sensor, but according to my understanding I need to configure POST method for exposing the sensor, and GET method for the 2nd RPi to read it. Am I correct here?
Reply to my own thread, I got it working!
My solution was to directly control switch/input_boolean on the remote hassio instance, and not trying to read primary hassio sensors with the remote hassio.
So for anyone puzzling with similar setup, here’s my solution:
Create “Long-Lived Access Token” on the remote RPi, the one which has the switches etc. you want to control remotely. You’ll find this token-menu when you click your username one the lower left corner.
Create automation to trigger your ‘rest_command’ when the input_boolean state changes.
automation:
- alias: 'my remote automation'
hide_entity: True
initial_state: On
trigger:
- platform: state
entity_id: input_boolean.my_switch
action:
- service: rest_command.my_rest_command
How it works:
You control e.g. some input_boolean on your main Hass.io instance, (ENTITY_NAME_ON_1ST_RPI) and that action gets cloned to another entity (ENTITY_NAME_ON_2ND_RPI) on the remote Hass.io instance. Change everything written in capital letters (except ‘method POST’) according to your setup.