HomeAssistant Rest API test Driver - Printable Version +- CQC Community Support Forum (https://cqccommunity.com) +-- Forum: Community General Discussion (https://cqccommunity.com/forumdisplay.php?fid=1) +--- Forum: Driver Development (https://cqccommunity.com/forumdisplay.php?fid=4) +--- Thread: HomeAssistant Rest API test Driver (/showthread.php?tid=11) |
HomeAssistant Rest API test Driver - kfly - 01-27-2024 Looks like Home Assistant Rest API works pretty good with CQC and should help those of use that need to add a few unsupported devices to CQC. As everyone knows there is no other HA system out that compares to the configurability of the GUI interface you get from CQC. So why not just let HomeAssistant poll the device and CQC can lookup state/attributes from HA. Here is a first cut of a test driver. Driver install prompts: 1. HomeAssistant Long-lived access token (see below) 2. Polling Interval (default is 5 seconds) 3. HomeAssistant Hub IP address example: 192.168.1.1 4. List of HomeAssistant Entities to be polled (see format below) HomeAssistant_0.2.zip (Size: 31.44 KB / Downloads: 7) Note:
You need to Generate a Long-lived access token(Personal Access Token) Home assistant -> "your profile" -> Long-lived access tokens https://community.home-assistant.io/t/how-to-get-long-lived-access-token Devices to Poll: Format is Entity ID in HomeAssistant (example below) Home assistant -> Settings -> Devices & services -> Entities example: light.scene_capable_plug_in_dimmer,light.sengled_solar_light,switch.ktest_appliance_switch,lock.front_door_lock,sensor.workshop_flood_sensor_air_temperature,binary_sensor.workshop_flood_sensor_water_leak_detected Please feel free to fix, enhance or change driver as needed. maybe:
Obviously the Rest API Driver is not intended for a bunch of devices/entities/sensors. The "http://{{hass_url}}/api/states/{entity ID}" poll is pretty small and efficient. unlike the smartthings hub where you hand to pull a ton of capabilities and parse out. One major change from smartthings api is all commands to HomeAssistant are done by calling a Service "http://{{hass_url}}/api/services/light/" instead of just calling the device(smartthings) or EntityID(HomeAssistant) and setting the attributes. I see no reason someone couldn't write a cool websockets driver so we can migrate all our CQC devices to HomeAssistant and still use CQC as the GUI frontend. https://developers.home-assistant.io/docs/api/websocket Troubleshooting: Make sure all the devices you are polling are online in HomeAssistant. Devices in offline/strange states may stop driver from connecting to HA because of the unexpected data returned from HA. RE: HomeAssistant Rest API test Driver - znelbok - 08-07-2024 Well Done This is something I promoted a long time ago but I dont have time to give it a go so I thank you greatly for doing it. I'll run this up soon and post my finding. My HA is running on a Pi and I have not logged into it for a long time so now's the time to get it going again. I think that if we can get it going nicely, the HA community will probably jump on it and CQC will explode in popularity. RE: HomeAssistant Rest API test Driver - Shaky - 12-15-2024 I just gave this a try. Bought some Twinkly lights which HA finds on its own and works well there. Now I can turn them on and off in CQC as well. Thanks for writing and posting this driver! |