bphillips09 / Control4-HA-Thermostat

Connects Home Assistant thermostat entities to Control4
8 stars 3 forks source link

Feature request #12

Open mredeker opened 2 months ago

mredeker commented 2 months ago

Hi guys,

thanks for this stuff. It's really cool and I will try to help and test. Would it be possible to have the poll time be configured by a property on composer? And also would it be possible to make the error text which is in the JSON response from HA available as C4 variable to be used in programming?

Thanks, -Marcus

bphillips09 commented 2 months ago

@mredeker Thanks for the support.

Polling isn't typically used since whenever HA gets an updated value for an entity it will tell C4 about it. Do you have a use-case for using polling?

For error text, what is your use-case?

mredeker commented 2 months ago

Hi, I did not know that there is an active connection from HA back to C4. How does that work? Websocket? I guess then the polling is fine the way it is, although a property is always convenient instead hard-coded ;)

For the error: I use the thermostat driver to connect to my pool heat pump which will give a status (e.g. preasure to low when the water pump is off). I can see the status message in the error property in the HA JSON response. So it should not be to difficult to make that available. I could then use C4 programming to send message to me in case of error.

Thanks, -Marcus

bphillips09 commented 2 months ago

@mredeker It uses Home Assistant's WebSocket API to maintain the connection and polling can be used as a backup (though it typically isn't used).

Since HA thermostat errors are not typical functionality and not expected during routine use, I probably won't add support for it. Assuming your error message is an attribute on your thermostat entity, you can make a template sensor from that and use that in C4 with my HA Generic Sensor driver.

For example, if your pool heat pump is climate.pool_thermostat and it has an error attribute, you can make that its own sensor (sensor.pool_thermostat_error) like this in your configuration.yaml:

template:
  - sensor:
      - name: "Pool Thermostat Error"
        unique_id: "pool_thermostat_error"
        state: "{{ state_attr('climate.pool_thermostat', 'error') }}"
        attributes:
          friendly_name: "Pool Thermostat Error"

You can use that entity with the Generic Sensor driver and use the string value for events inside C4 programming or similar.