sensor:
- platform: rest
name : cam102
resource: http://ipaddres:80/api/globalVariables/Cam102LineDet
method: POST
payload: ‘{ “Value” : “9” }’
username: user
password: password
authentication: basic
headers:
User-Agent: Home Assistant
Content-Type: application/json
errors are now:
2017-09-16 20:49:18 ERROR (Thread-2) [homeassistant.util.yaml] mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 58, column 12
2017-09-16 20:49:18 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 58, column 12
Tried the first leg just to define a sensor in Configuration.yaml
sensor:
- platform: rest
name: cam102
resource: http://ipaddres:80/api/globalVariables/Cam102LineDet
method: POST
payload: '{ “Value” : “1” }'
username: user
password: password
authentication: basic
headers:
User-Agent: Home Assistant
Content-Type: application/json
in the automations.yaml
alias: Bathroom1_Cam102
trigger:
platform: state
entity_id: binary_sensor.bathroom1_line_crossing
from : 'off’
to : 'on’
action:
service : sensor.turn_on
entity_id : sensor.cam102
but got the following errors home-assistant.log
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 58, column 12
2017-09-16 20:49:18 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 58, column 12
The RESTFul documents show definition of payload. Perhaps I should try a “value_template”
or should just simply execute the working python script in an alternative method.
or try an define it as switch.
2017-09-16 20:44:16 ERROR (Thread-2) [homeassistant.util.yaml] mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 57, column 11
2017-09-16 20:44:16 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 57, column 11
You’ve got too many spaces, each level should be two, not three. Yaml is very picky about you getting spaces in the right places, and not in the wrong places.
sensor:
- platform: rest
name: cam102
Is the correct indenting. You’ve also got a problem in that you’re using “smart” quotes:
payload: '{ “Value” : “1” }'
Should be
payload: '{ "Value" : "1" }'
The automation also has incorrect spacing, and smart quotes. It should be:
alias: Bathroom1_Cam102
trigger:
platform: state
entity_id: binary_sensor.bathroom1_line_crossing
from: 'off'
to: 'on'
action:
service: sensor.turn_on
entity_id: sensor.cam102
Also, there’s no service sensor.turn_on - you can’t turn sensors on.