Custom Component: Hubitat

What do they show up as? Just a switch?

Ideally, fan devices should end up as fan entities in HA. So, if you go to the entity list and search for “fan.”, they would show up there.

Whether or not devices are treated as fans depends on how Hubitat presents them through the Maker API. You can check the device capabilities to see if they include the Fan capability. If they do, then they should have associated fan entities. If not, then the integration needs to try to figure out what they are.

It appears they have the capabilities for speed control but doesn’t appear to have the same funcations in HA. They do show as fan entities in HA.

[
  {
    "capabilities": [
      "Switch",
      {
        "attributes": [
          {
            "name": "switch",
            "currentValue": "on",
            "dataType": "ENUM",
            "values": [
              "on",
              "off"
            ]
          }
        ]
      },
      "Configuration",
      "SwitchLevel",
      {
        "attributes": [
          {
            "name": "level",
            "currentValue": "99",
            "dataType": "NUMBER",
            "values": null
          }
        ]
      },
      "Refresh",
      "Actuator",
      "FanControl",
      {
        "attributes": [
          {
            "name": "speed",
            "currentValue": "high",
            "dataType": "ENUM",
            "values": [
              "low",
              "medium-low",
              "medium",
              "medium-high",
              "high",
              "on",
              "off",
              "auto"
            ]
          }
        ]
      },
      "PushableButton",
      {
        "attributes": [
          {
            "name": "numberOfButtons",
            "currentValue": "2",
            "dataType": "NUMBER",
            "values": null
          },
          {
            "name": "pushed",
            "currentValue": "1",
            "dataType": "NUMBER",
            "values": null
          }
        ]
      },
      "DoubleTapableButton",
      {
        "attributes": [
          {
            "name": "doubleTapped",
            "currentValue": "2",
            "dataType": "NUMBER",
            "values": null
          }
        ]
      }
    ]
  }
]
``

I noticed that pure button emitters are not showing up as devices any more. Was there a bug regression after 0.4.5? I recall being able to use the device to create automations but I don’t see that any more and I don’t see it listed as a Device/Entity

I’m also not getting any events emitted under “hubitat_events” when I press a button. I do see them show up in the Hubitat logs though.

Running v0.5.2 currently.

What controls do you see if you click on the fan entity in HA? This is one of my fans:

Hmmm…it looks like devices aren’t being created for pure emitters. I’ve re-opened the original issue.

Thanks! Appreciate looking into it.

See screen grabs below. Its just showing as a on/off switch.

fan4

Since the update to 0.110.x I get these deprecation warnings, is that a known thing?

AlarmControlPanel is deprecated, modify HubitatSecurityKeypad to extend AlarmControlPanelEntity
8:40:53 PM – Alarm control panel (WARNING)
LockDevice is deprecated, modify HubitatLock to extend LockEntity
8:40:53 PM – Lock (WARNING)
Entity id already exists - ignoring: switch.begane_kelderkast_sirene. Platform hubitat does not generate unique IDs
8:40:53 PM – Switch (ERROR)
SwitchDevice is deprecated, modify HubitatSwitch to extend SwitchEntity
8:40:53 PM – Switch (WARNING) - message first occurred at 8:40:53 PM and shows up 3 times
Light is deprecated, modify HubitatLight to extend LightEntity
8:40:53 PM – Light (WARNING)
CoverDevice is deprecated, modify HubitatCover to extend CoverEntity
8:40:53 PM – Cover (WARNING) - message first occurred at 8:40:53 PM and shows up 4 times
ClimateDevice is deprecated, modify HubitatThermostat to extend ClimateEntity
8:40:53 PM – Climate (WARNING)
BinarySensorDevice is deprecated, modify HubitatContactSensor to extend BinarySensorEntity
8:40:53 PM – Binary sensor (WARNING) - message first occurred at 8:40:53 PM and shows up 8 times

Yup, the deprecation warnings are a known issue, and will be fixed in the next release.

2 Likes

If you go to Developer Tools -> States in HA and pick one of the fans, what is listed under “State attributes”?

See below. Very limited information on the device.

Oooo, I see the problem. I’ve created an issue to track it. I should be able to get a fix in for that in the next release.

I really love how HA handles certain things. Like, I just added a relay to one of my garage doors. I already had a sensor to check if it was open. Combining the two into a functioning door controller just required a few lines in configuration.yaml to setup a template cover device. No extra app, no weird device settings, and the cover shows up in Alexa and HomeKit as a normal garage door controller.

4 Likes

Coming back to this, this is giving me unexpected results. I ended up having to make this far more complicated in Node-Red, but that could be my inexperience with YAML.

When I set up a trigger like this, here’s what I see as the YAML code for the trigger

event_data:
  attribute: code_name
  device_id: '194'
  device_name: lock.front
  value: Main Code
event_type: hubitat_event
platform: event

The problem is, this never triggers. An actual hubitat_event doesn’t use “event_data:” it just uses “data:”. I’m not sure if that’s the actual issue, but that trigger never works.

{
    "event_type": "hubitat_event",
    "data": {
        "device_id": "194",
        "device_name": "lock.front",
        "attribute": "code_name",
        "value": "Main Code",
        "description": "lock.front was unlocked by Main Code",
        "type": null
    },

I’ve even tried injecting the event right onto the bus and can’t get it to trigger as expected.

This worked in Node-Red by using this function, but wasn’t my first goal.

if (msg.payload.event.value == "Main Code" && msg.payload.event.device_id == "194") {
   msg.payload = "unlockedCode"
   return msg;
} else {
   return null;
}

In my own test with a lock device, this trigger works:

event_data:
  attribute: code_name
  device_id: '2086'
  value: Hubitat
event_type: hubitat_event
platform: event

The use of event_data is normal. HA matches the content of a trigger’s event_data with the data of an event.

I’m guessing the issue is with your device_name property. That’s the “friendly” name of the device, not an HA entity ID. In any case, it’s redundant since you’re also including the device_id in the selector data.

My bad, it wasn’t the trigger but rather a faulty condition. Once I deleted the rule and tried it again with no conditions it worked fine. Thanks for all of the work on this integration.

Mind sharing that node-red flow? I haven’t taken a real crack at it yet and it would give me a good starting point :slight_smile:

Sure, I’m sure it’s way messier than need be, but it works well. It listens for hubitat_events and then parses the output via function and then checks it against the current time of day to see if it should act.

In my case, if the front door is unlocked via the “Main Code” and it’s between Sunset-3AM it will turn on some entry lights.

[{"id":"e15622bd.6a2e","type":"server-events","z":"6e8c74e9.946a4c","name":"Hubitat_Events","server":"403857dc.a507","event_type":"hubitat_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":100,"y":1380,"wires":[["6e1e7ea9.f68738"]]},{"id":"6e1e7ea9.f68738","type":"function","z":"6e8c74e9.946a4c","name":"Parse Front Door - w/Code","func":"if (msg.payload.event.value == \"Main Code\" && msg.payload.event.device_id == \"194\") {\n   msg.payload = \"unlockedCode\"\n   return msg;\n} else {\n   return null;\n}\n\n","outputs":1,"noerr":0,"x":280,"y":1460,"wires":[["b29c7133.575ca"]]},{"id":"b29c7133.575ca","type":"switch","z":"6e8c74e9.946a4c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"unlockedCode","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":1360,"wires":[["4589adf.5527dd4"]]},{"id":"4589adf.5527dd4","type":"time-range-switch","z":"6e8c74e9.946a4c","name":"","lat":"33.838","lon":"-118.33928","startTime":"sunset","endTime":"03:00","startOffset":0,"endOffset":0,"x":520,"y":1280,"wires":[["8a813953.1bee98"],[]]},{"id":"8a813953.1bee98","type":"api-call-service","z":"6e8c74e9.946a4c","name":"","server":"403857dc.a507","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.dining, light.mid","data":"{\"brightness_pct\":\"55\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":650,"y":1400,"wires":[[]]},{"id":"403857dc.a507","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
1 Like

Jason,

Currently I have one device which is not coming over from hubitat. See below for the device information. Its a a sage door sensor. Any chance this could be pulled in as part of this custom component? Appreciate all the hard work.

[
  {
    "capabilities": [
      "Configuration",
      "Actuator",
      "PushableButton",
      {
        "attributes": [
          {
            "name": "numberOfButtons",
            "currentValue": "2",
            "dataType": "NUMBER",
            "values": null
          },
          {
            "name": "pushed",
            "currentValue": "1",
            "dataType": "NUMBER",
            "values": null
          }
        ]
      }
    ]
  }
]

That’s probably due to a regression that was introduced in 0.5.0. Event emitters (like pushbuttons) weren’t being properly registered.

That should be fixed in v0.5.3, which I just published.

4 Likes