We’re currently attempting to integrate Knocki into Home Assistant (HA). Knocki is a smart home device that transforms any surface into a gesture-enabled control interface for managing your favorite functions.
For our initial release, We’re aiming to execute a Home Assistant automation whenever a specific action is triggered through Knocki. Each action is identified by an ID along with a description. Knocki will send a payload to a topic configured in Home Assistant using either MQTT or WebSockets, whichever is easiest. Essentially, the payload will only contain the triggered action ID. Upon reception, Home Assistant should then verify existing automations using the action id as a trigger.
We’re relatively new to Home Assistant, and any assistance you can offer would be greatly appreciated! Our aim is to keep things as straightforward as possible during this initial phase. Therefore, we believe your insights could provide valuable guidance on how to proceed.
We’re excited to get our Home Assistant integration ready for the community - our customers have been requesting this for a long time.
@juanknocki do we have any other technical questions for Tom_I and/or the community?
If any of you are willing to connect with us via Slack and help out with the integration, we’d gladly throw a free Knocki your way to show our appreciation.
Hey @tom_l! We’re fairly new here. We’ve created the Event Entity and successfully instantiated our first entity. Now, we’re exploring methods to subscribe to incoming events, such as MQTT or WebSockets. What would you recommend? In your documentation (Event entity | Home Assistant Developer Docs), it’s mentioned that we need to call my_device_api.listen . Could you provide some examples or guidelines to get started on this? While I’ve begun examining examples on GitHub of your existing integrations, having a straightforward method would be greatly appreciated! Additionally, as @knocki mentioned earlier, we’re open to collaborating with anyone interested in working together.
I am not a developer, just a lowly forum moderator. You would be best to ask these questions in one of the developer channels on the Home Assistant Discord server.
@tom_l thanks for the pointer. We’ve posted our questions on HA’s Discord per your advice and already have a few folks generously offering to help. Hopefully we can get the integration out by June!
@knocki@juanknocki Hi. I hadn’t heard about Knocki before the integration appeared in the last HA release. So I bought one to evaluate. After some challenges it is now sitting on one of my VLANs and I’m receiving notifications on my phone.
My next challenge is to build an HA/Node-RED automation and I note that the integration fires an event - but which event? Is it a state_changed event for example, or something else?
I really like MQTT for this kind of thing and use zigbee2MQTT extensively for my sensors. I consider its pub/sub architecture to be superior to webhooks on many counts. If my Knocki could send MQTT packets to my Mosquitto broker I’d be a happy bunny.
I should add…If you are new to HA you might not know that the MQTT integration can create devices and entities for you - something called MQTT Discovery:
Hey, just got my knocki integrated and everything works.
Im trying to figure out how to create an automation trigger for the event entity it makes.
At the moment, have separate event entities for 3 and 4 knocks. When it activates, it just says event detected.
I’d rather not use just any state change for the automation trigger so therefore finding the actual event details would be beneficial here.
Listening to events I’ve tried already but for some reason I can’t see it on the list of events maybe because I have too many events happening? How do I listen to a specific entity?
@Anto79-ops Same problem here. I am used to events being behind-the-scenes things which change device/entity states, not things I should find a way to ‘subscribe to’ in my automations. For me, triggers are usually based on entity state changes not events. I’m pretty sure that’s the way HA users think, generally.
I can see that an event arrived named:
event.knc1_w_000xxxxx_testing_knocki_1
but can’t capture any data associated with it so I can’t proceed. Perhaps that’s all there is. Maybe @knocki can clarify.
From my testing, for anyone trying out Knocki -
Get the latest firmware (ask Knocki support to push it to your device). Mine is currently 1.0.5-rc4. The Knocki app’s Home Assistant Task doesn’t appear in 1.0.2 which the device arrived with.
@hunterdrayman I hear you, from what I understand, you ahve to listen to any events that the entity gives, at least for now. Here’s my automation, for example, that turns a lightt on and off. Notice the not to and not from additions. I relize this is not the most robost way to do it, but it works.
PS. you may wish to edit your post and remove the serial number in your entity.
Thanks @Anto79-ops. That was a very helpful example and after some customisation (and integration reload) it worked for me. I can now experiment further whilst hoping that a more conventional mechanism will be developed.
I might just emit an MQTT message and have the MQTT integration create a device/state entity on which I can base my automations.
That worked, I was able to create a gesture and I can see the event on the event bus when i run a test for the gesture. What I’m confused about now is how to actually use this to create automations. The state of the sensor is always “Triggered”. It never resets to another state, so I can’t use state change without yet another automation to reset the sensor.
Is this still a work in progress? It seems like this integration isn’t ready yet. The Knocki really should be a “device” in home assistant. Dealing with raw events are beyond the ability of most users, myself included.
EDIT: I see from the previous post that this is still in beta. I didn’t realize that beta integrations were included in Home Assistant core.
I ended up getting this to work. I didn’t realize that by simply specifying the event in the automation trigger and nothing else that it would look for the firing of the event and not a state change.