Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106094

Govee Heater Integration with api2.0 via rest calls

$
0
0

Hi Everyone, Could use some help here. I am trying to integrate my Govee Heater via rest api calls.

when I send a POST msg, I get back a bunch of values. Therefore, my first attempt to integrate it was by creating sepereate sensors with each of the values. But this is problematic as all the sensors are calling the api all the time , and I have a limitations. so I wanted call the Api once and store all the attributes as a sensor. How do i do that? My current integration is provided below, but this way I get all the values at once as state, but not attributes (as shown in the picture). Is there a way to parse each of the attributes and store then as a sensor? this is my code: - platform: rest

name: “Sami Heater State”

unique_id: sami_heater_state

resource: “https://openapi.api.govee.com/router/api/v1/device/state

method: POST

headers:

Content-Type: application/json

Govee-API-Key: !secret govee_api_key

payload: !secret govee_heater_payload

value_template: >

{{

{

‘online’: value_json.payload.capabilities[0].state.value,

‘power_switch’: value_json.payload.capabilities[1].state.value,

‘oscillation_toggle’: value_json.payload.capabilities[2].state.value,

‘nightlight_toggle’: value_json.payload.capabilities[3].state.value,

‘brightness’: value_json.payload.capabilities[4].state.value,

‘color_rgb’: value_json.payload.capabilities[5].state.value,

‘nightlight_scene’: value_json.payload.capabilities[6].state.value,

‘target_temperature’: value_json.payload.capabilities[7].state.value.targetTemperature,

‘sensor_temperature_F’: value_json.payload.capabilities[8].state.value,

‘sensor_temperature_C’: ((value_json.payload.capabilities[8].state.value - 32) * 5 / 9) | round(1),

‘work_mode’: value_json.payload.capabilities[9].state.value.workMode

}

}}

json_attributes:

  • online

  • power_switch

  • oscillation_toggle

  • nightlight_toggle

  • brightness

  • color_rgb

  • nightlight_scene

  • target_temperature

  • sensor_temperature_F

  • sensor_temperature_C

  • work_mode

scan_interval: 30

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106094

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>