Rest Switch Help for Solar Geyser - geyserwise

Hi everyone

I am battling to get a rest switch working that has a different endpoint for the status as from the command itself. I have tried various formats etc without any luck. I would really appreciate any guidance.

Here are the details of the endpoints:

https://geyserwiseonline.com/AutomationService/api/unit/GetUnitStatus?apiKey=xxxxxxx=&unitid=abc
This returns a number of attributes/properties. The one I am interested in is “Element” which should update the status of the “switch”

{
    "Element": "off",
    "Temperature": "45",
    "Exception": "",
    "TimeLogged": "2021-06-17 22:03",
    "CollectorTemperature": "43",
    "HolidayMode": "off",
    "TestPump": "off",
    "AntiFreeze": "6",
    "Solar": "7",

The endpoint for the command to change the status of the “switch” is:

https://geyserwiseonline.com/AutomationService/api/unit/SetElement?apiKey=xxxxxxxx&unitid=abc&Uniton=false

Where changing the “Uniton” to true or false switches on or off.

I think that part of the problem is that the “Element” attribute is not a true boolean in that it can return a status of “on”, “off” or “standby”. “standby” means that it is currently not heating even though it is meant to be “on” as the temperature is already correct.
In effect “standby” should actually show as “off” on the “switch” status.

I have tried a bunch of variations around this:

  - platform: rest
    name: Geyserwise Element
    resource: https://geyserwiseonline.com/AutomationService/api/unit/SetElement?apiKey=JZh5lmee11Z8oG7SsdhaNXPjaJFghX4CrWZLqJf5sc&unitid=2985
    state_resource: https://geyserwiseonline.com/AutomationService/api/unit/GetUnitStatus?apiKey=JZh5lmee11Z8oG7SsdhaNXPjaJFghX4CrWZLqJf5sc&unitid=2985
    body_on: 'Uniton=true'
    body_off: 'Uniton=false'
    headers:
      Content-Type: application/x-www-form-urlencoded

I have actually lost the last bunch I tried due to a power failure causing a corruption of my HA instance and having to return to a backup from a few days prior.

Thank you for your guidance and assistance

Did you come right with this ? Im also wanting to move to the REST api option apart from the previous implementation used at Geyserwise WIFI module integration (Request) - #3 by Pro2col

Unfortunately no luck. I have been wanting to post on the HA discord server to see if anyone has any ideas but haven’t got round to it as yet. Please let me know if you do come right and I will do the same here

I came right using the shell_command as a switch, but its a work around for until I see someone apply it more effectively as a REST that can also detect state etc. Im guessing and “hacking” my way around all this.

in configuration.yaml I added

shell_command:
  geyser_switch_1_on: 'curl -k "https://geyserwiseonline.com/AutomationService/api/unit/SetElement?apiKey=(API KEY PROVIDED BY GEYSERWISE)&unitid=(UNITID PROVIDED BY GEYSERWISE)&Uniton=true"'
  geyser_switch_1_off: 'curl -k "https://geyserwiseonline.com/AutomationService/api/unit/SetElement?apiKey=(API KEY PROVIDED BY GEYSERWISE)&unitid=(UNITID PROVIDED BY GEYSERWISE)&Uniton=false"'

and then in my switches I use

- platform: template
  switches:
    main_geyser_manualoverride:
      turn_on:
        service: shell_command.geyser_switch_1_on
      turn_off:    
        service: shell_command.geyser_switch_1_off

This all works using automation to call these switches.

Note there is still a 10-15 second delay for the geyserwise to actually turn on and off once the switch is triggered.

Hi I just installed the GW and looking at the API can anyone perhaps post their full GW config in Config.yaml ?