Custom Component: Hubitat

Thank you, this helped me figure it out!!

Much easier than the virtual switch / button controller tom-foolery I was having to do in Hubitat and push to HA to get the state change.

It seems like after latest update I lost all of my switches from Hubitat. Anyone else noticing same?

1 Like

Yes, happened to me too.

I believe that how entities are identified by the integration changed due to some internal refactoring. I’m working on restoring the previous behaviour.

3 Likes

25.01 no longer loads the Hubitat Component. Look at your integration it should indicate “Not Loaded”. Looking for a solution.

Updating to the latest release (v0.9.17 at the moment) should resolve that.

Thank you!

Hello team… i have a dumb question.
In HA setup i have a temperature sensor entity (basically a Alexa Media player entity that is reading the temperature from Echo Dot).
I want to access data from this sensor in HA from Hubitat.

So i created a “Virtual temperature sensor” in Hubitat, shared that to HA.
Now how do i update the value of this virtual sensor from the temp sensor that i have in HA?

I know i have to use “templates” but i am kinda lost. Any help?

Now how do i update the value of this virtual sensor from the temp sensor that i have in HA?

Interesting…that’s not a use case I ever really envisioned. At first I assumed it wouldn’t be possible (you can’t typically update Hubitat sensor values from HA), but it actually is. You can use a setTemperature command with the virtual sensor entity:

service: hubitat.send_command
data:
  entity_id: sensor.virtual_temperature_sensor_temperature
  command: setTemperature
  args: 20

That’s the manual way to get the temperature into Hubitat, at least. To send temperature updates automatically, one way would be to use an automation.

Create a new automation that triggers on numeric state updates from your temperature sensor entity. Then add a “call service” action that will send the sensor’s value to the Hubitat virtual sensor:

service: hubitat.send_command
data:
  entity_id: sensor.virtual_temperature_sensor_temperature
  command: setTemperature
  args: "{{ trigger.to_state.state }}"

There are a couple blueprints for syncing entities, kind of like the mirror app in hubitat. I’ve only used them on light switches and they’ve been kind of flaky but might be a place to start.

Thanks for much. I had observed the setTemperature command, but did not know about the "service: hubitat.send_command.

I created the following automation:

- id: "1704401304302"
  alias: Temprature test - Office
  description: ""
  trigger:
    - platform: time_pattern
      minutes: "/1"
  condition: []
  action:
    - service: hubitat.send_command
      data:
        entity_id: sensor.office_temp_sensor_hack_temperature
        command: setTemperature
        args: { { states("sensor.work_echo_temperature") } }
  mode: single

but the “args” seems to be no right. i get the following error:
2024-01-04 20:09:35.895 ERROR (SyncWorker_8) [homeassistant.util.yaml.loader] invalid key: “{‘states(“sensor.work_echo_temperature”)’: None}”
in “/config/automations.yaml”, line 31, column 0
2024-01-04 20:09:35.896 ERROR (MainThread) [homeassistant.components.automation] invalid key: “{‘states(“sensor.work_echo_temperature”)’: None}”
in “automations.yaml”, line 31, column 0

if i use “args: 20” then it works fine and the virtual sensor on Hubitat side gets the value.

Any idea what i am doing wrong in the above automation arg setting?

I thing Home Assistant is interpreting the expression as an object definition. Try

      args: “{{ states(‘sensor.work_echo_temperature’) }}”

with that Hubitat gets the entire value as a string below:

Current States

  • temperature : {‘states(“sensor.work_echo_temperature”)’: None}

Tried something like this:
args: “{{states('sensor.work_echo_temperature')|float(0)}}”

but in the log i see this error:

  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 649, in state
    numerical_value = float(value)  # type:ignore[arg-type]
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '“75.6”'

The above exception was the direct cause of the following exception:

@jason0x43 I’m getting this error after the latest update. Can you tell anything from the message?

Summary

Logger: homeassistant.util.logging
Source: util/logging.py:102
First occurred: 3:23:19 PM (1 occurrences)
Last logged: 3:23:19 PM

Exception in async_forward_config_entry_changes when dispatching ‘config_entry_changed’: (<ConfigEntryChange.UPDATED: ‘updated’>, <ConfigEntry entry_id=1e029f8b22a6f51ee050562c068f05af version=1 domain=hubitat title=Hubitat (0ba2fab5) state=ConfigEntryState.NOT_LOADED unique_id=None>) Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 477, in async_forward_config_entry_changes integration = await async_get_integration(hass, entry.domain) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/usr/src/homeassistant/homeassistant/loader.py”, line 909, in async_get_integration raise int_or_exc homeassistant.loader.IntegrationNotFound: Integration ‘hubitat’ not found.

It looks like Home Assistant wasn’t able to load the Hubitat integration at all. What version of Home Assistant are you running?

@jason0x43 All of my HA components are up to date. Core and OS both updated in the past day or so.

Are there any relevant log statements from earlier in the HA startup process? It looked like the config entry didn’t load because the Hubitat integration didn’t load, so there should be an earlier error related to that.

Oh wait, I see something…