Hello. I would like to ask for some help with restful integration, moxa iologik and value templating. I’ve been trying all day but I surely miss something.
First of all, I want to use a Moxa Iologik e1212 as a general i/o modul for my home assistant system.
I tought that restful integration will be the easy way for doing this. For outputs it was, and controlling outputs is working fine.
But when I want to see inputs in home assistant there comes the problem.
I need to use some templating since the answer I get from the modul is not clear boolean or on/off.
This is the message I get when I ask the input status:
{“slot”:0,“io”:{“di”:{“0”:{“diStatus”:0}}}}
So I wanted to use this template at the rest binary sensor:
value_template: ‘{{value_json[‘io’][‘di’][‘0’][‘diStatus’]}}’
Binary sensor config:
- platform: rest
resource: http://192.168.1.126/api/slot/0/io/di/0/diStatus
value_template: '{{value_json['io']['di']['0']['diStatus']}}'
method: GET
name: MOXA_di_0
headers:
Content-Type: application/json
Accept: vdn.dac.v1
But when I check config I allway get an error
Error loading /config/configuration.yaml: while parsing a block mapping
in "/config/bin_sensor.yaml", line 8, column 3
expected <block end>, but found '<scalar>'
in "/config/bin_sensor.yaml", line 10, column 34
8/3 is the platform line and 10/37 is value_template line at [‘io’]
I just don’t know what is the problem.
Can someone help me, please?