Hi! I am trying to get status info from my new pool, and although there is no current HA integration for it fortunately I found that they do provide an API that talks JSON. So, if I use the following:
curl -X POST -H "Content-Type: application/json" --data '{"pool_api_code":"xxxxx-666666","temperature_scale":0'} https://192.168.0.1/api/poolstatus
I get:
{"pool_spa_selection":1,"heat_cool_selection":1,"temperature":15,"active_favourite":255,"heaters":[{"heater_number":1,"mode":0,"set_temperature":36,"spa_set_temperature":0}],"solar_systems":[],"channels":[{"channel_number":0,"mode":1},{"channel_number":1,"mode":0},{"channel_number":6,"mode":0},{"channel_number":7,"mode":0}],"valves":[],"lighting_zones":[{"lighting_zone_number":0,"mode":0,"color":17}]}
This tells me, amongst other things, that the water temperature is currently 15 degrees celsius and temperature for the heater is set to 36 degrees. To actually see this info in HA I thought that the RESTful integration would be a good way of doing it, but be danged if I can work out how to get the API info in there properly. I am thinking it would be something like:
sensor:
- platform: rest
name: poolsensors
resource: https://192.168.0.1/api/poolstatus
params:
- pool_api_code: !secret pool_api
- temperature_scale: 0
scan_interval: 600
json_attributes:
- pool_spa_selection
- heat_cool_selection
- temperature
- active_favourite
- set_temperature
But, and here’s where I need a pointer, I can’t get the “params” bit to work whether I use quotes, parenthesis, or nothing at all. I’m getting various dictionary error messages when testing it, which implies I’m getting the format wrong. I’ve had a hunt and can’t find any examples of anyone using “params” so maybe I’ve wandered off the path of righteousness. I’ve also tried just:
params: '{ "pool_api_code" : "!secret pool_api" }'
but no luck
I don’t have much experience with JSON so I am sure I am missing something obvious…