[RELEASE] Home Assistant Device Bridge (HADB)

We could also just make a custom Generic Component Occupancy Sensor with an "occupied" attribute.

1 Like

That probably would satisfy everybody

No, it would not break anything. I suppose we could create a custom child device with a custom ‘occupancy’ attribute as well. Lots of options… :thinking:

In general, I doubt this is going to be used by all that many users. Going with the simple design requested by @jlv might be the simplest and easiest solution. I personally feel that the ‘occupancy’ sensor will be used just like any other motion sensor.

1 Like

@tomw @ogiewon Both of you suggested the custom component as a possible solution. I think it is what we should go for.

@jlv can you work with that?

2 Likes

Correct. This is how it looks in HA.

With my change, I'm now getting them both exposed independently, and it seems to make sense, even if both show up as motion sensors.

FWIW, both the Hubitat Ecobee cloud API integrations I've used (the built-in one and the Ecobee Suite) expose the occupancy property as motion (but they don't expose the motion property; I don't think it's available in the cloud API). E.g., this is occupancy showing active:

image

I think having it as a motion sensor will make it the easiest to use in automations. I think making it presence works, too, albeit with a little loss in making easy automations. I think making it a custom component would make it the least obvious to use in a rule.

E.g., Room Lighting has motion as a easy to use Means To Activate. Either of the other options would require the use of selecting Custom Attribute. The same with Simple Automation Rules.

3 Likes

Another data point: the Aqara Fp1, which is a mmWave sensor and something that acts like a PIR (maybe it is a PIR).

The driver for it reports the PIR as motion and but the mmWave as presense.
image

Sounds like there is precedent for using motion as well as some benefits in other Hubitat built-in apps. Custom type wouldn't have any of that, so I prefer motion based on what @jlv shared.

3 Likes

Ok. I did not think about that.

Using presence as an occupancy sensor in Aqara driver is a choice made by the developer. Maybe Hubitat should add this capability.

So lets go for @jlv proposal then.

3 Likes

![16746198009326489209231737430783|666x500]
(upload://neeLOiXcc9K7ir9Oey8TKgt9En1.jpeg)

I did fallow the instruction above but Not sure why i can't find any devises from ha.

can't find any devises from ha.

Is this when trying to select devices from the app or when looking for included devices on the devices page from Hubitat hub?

South Africa is experiencing a massive energy crisis that has resulted in scheduled power cuts lasting 2.5 hours at a time, according to schedule (per neighborhood) that changes on an almost daily basis. In other words, scheduled blackouts that the energy provided calls "load shedding".
There's an add-on available for Home Assistant that pulls the schedules into HA from the internet. I set up HA in the hope that with the help of that add-on, I can access that information in HE. One of the entities the HA add-on creates, has an attribute "Starts In" which contains the time before the blackout starts (in minutes, e.g. "183"). I want to use this info to set up a rule in webCore that tests if my solar batteries' state of charge is high enough to last through the blackout, say, an hour before the scheduled blackout begins. If the state of charge is too low to last the 2.5 hour blackout, I want to change the solar inverter settings to draw power from the grid to charge the batteries so they have enough capacity to last for the duration of the black out. (I can change the inverter's settings from HE for this.)
The device where the information is stored in HA pulls through to HE with HADB, but unfortunately, not the attribute containing the information I need. (The Device Type assigned in HE is Generic Component Unknown Sensor

The device in HA looks like this:

And the attributes of the device:

Is there a way to pull through the attribute information to HE with HADB? Or perhaps by way of some other solution?

Thanks in advance.

Can you post your logs?

Sure. Which logs would you need?

As per instructions:

A change has to occur on the device reporting the attribute in order for a log to be generated.

1 Like

Sorry, I should have realized. I'm waiting for a the data to change - it my take a while because the schedules are only updated every few hours. I appreciate your help.

Be aware that the debug log toggle will turn off after 30 minutes

1 Like

Does this help?


(I have changed from Cape Town to my local area, in case you are wondering why it is now Dan Pienaar and not Cape Town)

Nop, You need to enable debug logging:

It will give you entries like this in the log:

It is the log for the parent device that we need, not the one from the specific entity.

Sorry, I had the wrong device. Think I've got it now. Sorry about that.

dev:13382023-01-30 21:59:53.789debugparse: domain: sensor, device_class: null, entity: sensor.load_shedding_area_mangaung_5_danpienaar, newVals: [off], friendly: Dan Pienaar (5)
dev:13382023-01-30 21:59:53.677debugparse(): description = {"id":1,"type":"event","event":{"event_type":"state_changed","data":{"entity_id":"sensor.load_shedding_area_mangaung_5_danpienaar","old_state":{"entity_id":"sensor.load_shedding_area_mangaung_5_danpienaar","state":"off","attributes":{"stage":0,"start_time":0,"end_time":0,"ends_in":0,"starts_in":121,"next_stage":4,"next_start_time":"2023-01-30T22:00:00+00:00","next_end_time":"2023-01-31T00:30:00+00:00","forecast":[{"stage":4,"start_time":"2023-01-30T22:00:00+00:00","end_time":"2023-01-31T00:30:00+00:00"},{"stage":4,"start_time":"2023-01-31T10:00:00+00:00","end_time":"2023-01-31T12:30:00+00:00"},{"stage":4,"start_time":"2023-02-01T08:00:00+00:00","end_time":"2023-02-01T10:30:00+00:00"},{"stage":4,"start_time":"2023-02-01T20:00:00+00:00","end_time":"2023-02-01T22:30:00+00:00"},{"stage":4,"start_time":"2023-02-02T06:00:00+00:00","end_time":"2023-02-02T08:30:00+00:00"},{"stage":4,"start_time":"2023-02-02T18:00:00+00:00","end_time":"2023-02-02T20:30:00+00:00"},{"stage":4,"start_time":"2023-02-03T04:00:00+00:00","end_time":"2023-02-03T06:30:00+00:00"},{"stage":4,"start_time":"2023-02-03T16:00:00+00:00","end_time":"2023-02-03T18:30:00+00:00"},{"stage":4,"start_time":"2023-02-04T02:00:00+00:00","end_time":"2023-02-04T04:30:00+00:00"},{"stage":4,"start_time":"2023-02-04T14:00:00+00:00","end_time":"2023-02-04T16:30:00+00:00"},{"stage":4,"start_time":"2023-02-05T00:00:00+00:00","end_time":"2023-02-05T02:30:00+00:00"},{"stage":4,"start_time":"2023-02-05T12:00:00+00:00","end_time":"2023-02-05T14:00:00+00:00"}],"last_update":"2023-01-30T19:09:33+00:00","attribution":"Data provided by sepush.co.za","icon":"mdi:calendar","friendly_name":"Dan Pienaar (5)"},"last_changed":"2023-01-30T19:09:38.265967+00:00","last_updated":"2023-01-30T19:58:53.227477+00:00","context":{"id":"01GR245M9B8P8SNZ5RCNTYYYHB","parent_id":null,"user_id":null}},"new_state":{"entity_id":"sensor.load_shedding_area_mangaung_5_danpienaar","state":"off","attributes":{"stage":0,"start_time":0,"end_time":0,"ends_in":0,"starts_in":120,"next_stage":4,"next_start_time":"2023-01-30T22:00:00+00:00","next_end_time":"2023-01-31T00:30:00+00:00","forecast":[{"stage":4,"start_time":"2023-01-30T22:00:00+00:00","end_time":"2023-01-31T00:30:00+00:00"},{"stage":4,"start_time":"2023-01-31T10:00:00+00:00","end_time":"2023-01-31T12:30:00+00:00"},{"stage":4,"start_time":"2023-02-01T08:00:00+00:00","end_time":"2023-02-01T10:30:00+00:00"},{"stage":4,"start_time":"2023-02-01T20:00:00+00:00","end_time":"2023-02-01T22:30:00+00:00"},{"stage":4,"start_time":"2023-02-02T06:00:00+00:00","end_time":"2023-02-02T08:30:00+00:00"},{"stage":4,"start_time":"2023-02-02T18:00:00+00:00","end_time":"2023-02-02T20:30:00+00:00"},{"stage":4,"start_time":"2023-02-03T04:00:00+00:00","end_time":"2023-02-03T06:30:00+00:00"},{"stage":4,"start_time":"2023-02-03T16:00:00+00:00","end_time":"2023-02-03T18:30:00+00:00"},{"stage":4,"start_time":"2023-02-04T02:00:00+00:00","end_time":"2023-02-04T04:30:00+00:00"},{"stage":4,"start_time":"2023-02-04T14:00:00+00:00","end_time":"2023-02-04T16:30:00+00:00"},{"stage":4,"start_time":"2023-02-05T00:00:00+00:00","end_time":"2023-02-05T02:30:00+00:00"},{"stage":4,"start_time":"2023-02-05T12:00:00+00:00","end_time":"2023-02-05T14:00:00+00:00"}],"last_update":"2023-01-30T19:09:33+00:00","attribution":"Data provided by sepush.co.za","icon":"mdi:calendar","friendly_name":"Dan Pienaar (5)"},"last_changed":"2023-01-30T19:09:38.265967+00:00","last_updated":"2023-01-30T19:59:53.229705+00:00","context":{"id":"01GR247EWD6KM4NFT577YDKE5M","parent_id":null,"user_id":null}}},"origin":"LOCAL","time_fired":"2023-01-30T19:59:53.229705+00:00","context":{"id":"01GR247EWD6KM4NFT577YDKE5M","parent_id":null,"user_id":null}}}

The Start_In is the data I would like to have in HE. It indicates the time before the next black out starts.