Home Assistant Service Call - JSON/Formatting Question
-
Hello -
As the subject implies, I'm trying to make a Service Call to Home Assistant and having formatting issues. I struggle with JSON so hoping someone can provide me direction.
Here's an example of working YAML in Home Assistant:
service: rinnai.start_recirculation data: recirculation_minutes: 5 target: entity_id: water_heater.bully_house_water_heater
-
Updated version was able to get past the parser but then get the below error from HASS.
[stable-22168]2022-08-22T21:54:52.506Z <HassController:null> HassController#hass: sending payload for x_hass_system.call_service on System#hass>system action: [Object]{ "type": "call_service", "service_data": { "data": "recirculation_minutes: 5", "target": { "entity_id": "water_heater.bully_house_water_heater" } }, "domain": "rinnai", "service": "start_recirculation" } [stable-22168]2022-08-22T21:54:52.511Z <HassController:ERR> HassController#hass request 1661205292508<2022-08-22, 5:54:52 p.m.> (call_service) failed: [Object]{ "id": 1661205292508, "type": "result", "success": false, "error": { "code": "invalid_format", "message": "extra keys not allowed @ data['data']" } }
Clearly doesn't like "data" being sent again. But I'm unclear how to send the "recirculation_minutes" and then the following "target" / "entity_id" parameter.
-
Try removing ‘data’, I had a similar issue and removing ‘data’ helped
-
this is a total shot in the dark but try this. Still figuring out calling services via MSR myself
{ "recirculation_minutes": "5", "target": {"entity_id": "water_heater.bully_house_water_heater"} }
-
@pabla Closer! Passes the parser and now a new error... I will play with this a bit later after meetings...
[stable-22168]2022-08-23T12:27:07.386Z <HassController:null> HassController#hass: sending payload for x_hass_system.call_service on System#hass>system action: [Object]{ "type": "call_service", "service_data": { "recirculation_minutes": "5", "target": { "entity_id": "water_heater.bully_house_water_heater" } }, "domain": "rinnai", "service": "start_recirculation" } [stable-22168]2022-08-23T12:27:07.391Z <HassController:ERR> HassController#hass request 1661257627388<2022-08-23, 8:27:07 a.m.> (call_service) failed: [Object]{ "id": 1661257627388, "type": "result", "success": false, "error": { "code": "invalid_format", "message": "value must be one of [5, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, 285, 300] for dictionary value @ data['recirculation_minutes']" } }
-
4/8