# eWeLink CUBE to Home Assistant via Node-RED

**URL:** <https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968>\
**Category:** eWeLink CUBE\
**Created:** [August 3, 2024, 9:24pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968 "2024-08-03T21:24:38Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![el404](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@el404](https://forum.ewelink.cc/u/el404)\
**Post date:** [August 3, 2024, 9:24pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/1 "2024-08-03T21:24:38Z")

</div>

How to extend the SNZB-04P from eWeLink CUBE to Home Assistant via Node-RED ?

---

<div class="post-metadata">

**Author:** ![Unnamedi](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/unnamedi/32/5677_2.png) [@Unnamedi](https://forum.ewelink.cc/u/Unnamedi)\
**Post date:** [August 4, 2024, 5:11am UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/2 "2024-08-04T05:11:41Z")

</div>

I believe you would have to create a sensor via the HA API node.  
However, it would be easier to send via some integration.

---

<div class="post-metadata">

**Author:** ![Unnamedi](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/unnamedi/32/5677_2.png) [@Unnamedi](https://forum.ewelink.cc/u/Unnamedi)\
**Post date:** [August 4, 2024, 5:24am UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/3 "2024-08-04T05:24:35Z")

</div>

But as you are already using node-red it would be better to use it to talk to both of you. instead of sending the sensor to HA. you should create the automations in the red node.  
There would be no reason why export the sensor to the HA.

Because the red node talking to HA and iHost you would have access to everything that is connected on both platforms.

---

<div class="post-metadata">

**Author:** ![el404](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@el404](https://forum.ewelink.cc/u/el404)\
**Post date:** [August 4, 2024, 12:24pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/4 "2024-08-04T12:24:07Z")

</div>

> [@el404](#):
>
> extend

I have no choice, because the SNZB-04P does not work in the home bridge. From home bridge, I can extend it into HA, but it doesn’t work. Therefore, I am looking for options on how to implement it correctly.

---

<div class="post-metadata">

**Author:** ![ward](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/ward/32/10437_2.png) [@ward](https://forum.ewelink.cc/u/ward)\
**Post date:** [August 5, 2024, 6:09am UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/5 "2024-08-05T06:09:41Z")

</div>

Matter Bridge would work, but you didn’t mention which installation type of your HA; Supervised and HAOS would do the job.

Also a fix for HomeBridge will land by the end of this month.

---

<div class="post-metadata">

**Author:** ![el404](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@el404](https://forum.ewelink.cc/u/el404)\
**Post date:** [August 5, 2024, 1:48pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/6 "2024-08-05T13:48:41Z")

</div>

In Node Red SNZB04P don’t have state “Contact (binary)”, only battery, rssi and tamper alert. What should I do?  
 ![snzb04p-node-red](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/4/4ed5019ac8664b28d599014df46c5a8544bf6056.png)

---

<div class="post-metadata">

**Author:** ![ociepa.ekotox](https://avatars.discourse-cdn.com/v4/letter/o/c68b51/32.png) [@ociepa.ekotox](https://forum.ewelink.cc/u/ociepa.ekotox)\
**Post date:** [August 5, 2024, 2:23pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/7 "2024-08-05T14:23:07Z")

</div>

Please upgrade your node-red-contrib-ewelink-cube to version 1.2.4.  
Then you should be able to receive the state in event-state node with “All” option selected.

It’s a temporary workaround.

---

<div class="post-metadata">

**Author:** ![el404](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@el404](https://forum.ewelink.cc/u/el404)\
**Post date:** [August 5, 2024, 2:34pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/8 "2024-08-05T14:34:44Z")

</div>

> [@ociepa.ekotox](#):
>
> version 1.2.4

version 1.2.4 installed  
 ![1.2.4](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/6/633c74088d2750d9ae206bdacd40b2bc13e8d0c8.png)

---

<div class="post-metadata">

**Author:** ![ociepa.ekotox](https://avatars.discourse-cdn.com/v4/letter/o/c68b51/32.png) [@ociepa.ekotox](https://forum.ewelink.cc/u/ociepa.ekotox)\
**Post date:** [August 5, 2024, 4:08pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/9 "2024-08-05T16:08:12Z")

</div>

![event-state node_SNZB-03](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/f/ff9d1ab80cba4afab62cd1c6be9e950bcfcf44d6.jpeg)

only node (event - state) works

---

<div class="post-metadata">

**Author:** ![el404](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@el404](https://forum.ewelink.cc/u/el404)\
**Post date:** [August 5, 2024, 4:24pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/10 "2024-08-05T16:24:05Z")

</div>

i’am talking about SNZB04P, in node red, it has only 3 statuses - rssi, battery, tamper alert and doesn’t have - detect state

---

<div class="post-metadata">

**Author:** ![ociepa.ekotox](https://avatars.discourse-cdn.com/v4/letter/o/c68b51/32.png) [@ociepa.ekotox](https://forum.ewelink.cc/u/ociepa.ekotox)\
**Post date:** [August 5, 2024, 4:31pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/11 "2024-08-05T16:31:09Z")

</div>

![event-state node_SNZB-04P](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/f/fd133aec7c54f2f0bd96b95da6434b5ce1fc4e8a.jpeg)

I did the test. I removed the sensor and added it to ihost again. in node-red the status is displayed. what version of snzb-04P do you have (mine is v2.2.0)

---

<div class="post-metadata">

**Author:** ![el404](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@el404](https://forum.ewelink.cc/u/el404)\
**Post date:** [August 6, 2024, 10:06am UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/12 "2024-08-06T10:06:22Z")

</div>

Can you tell me how to make a virtual door sensor correctly? I want to make a virtual sensor with a status that can be turned on or off. And take the state from the real SNZB 04P sensor. I don’t understand how to implement it yet. All this is to throw at homebridge.

UPD  
It seems to have been done (attached a screenshot). But I don’t know if it’s right. The state is transmitted and the virtual door changes state, although without a battery.

 ![node-red](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/d/d757fc8ed672fd28b3662d1baa73e5506506f9f7.png)

---

<div class="post-metadata">

**Author:** ![Unnamedi](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/unnamedi/32/5677_2.png) [@Unnamedi](https://forum.ewelink.cc/u/Unnamedi)\
**Post date:** [August 6, 2024, 10:21pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/13 "2024-08-06T22:21:46Z")

</div>

Could you pass on the node configuration?  
So I can help?

---

<div class="post-metadata">

**Author:** ![Unnamedi](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.ewelink.cc/unnamedi/32/5677_2.png) [@Unnamedi](https://forum.ewelink.cc/u/Unnamedi)\
**Post date:** [August 6, 2024, 10:25pm UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/14 "2024-08-06T22:25:54Z")

</div>

![image](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/d/df3542fe7e99ba79438935edfb52953c018ba492.png)  
An example here would be getting the information about the on or off status!

![Captura de tela 2024-08-06 192344](https://europe1.discourse-cdn.com/flex005/uploads/ewelinkforum/original/2X/c/c7e66451f8a835248cfdb217c6e401a512c4a78a.png)

I don’t see the point in using Json and the status change node.

Since I believe you are using the ALL status.

---

<div class="post-metadata">

**Author:** ![el404](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@el404](https://forum.ewelink.cc/u/el404)\
**Post date:** [August 7, 2024, 9:48am UTC](https://forum.ewelink.cc/t/ewelink-cube-to-home-assistant-via-node-red/44968/15 "2024-08-07T09:48:05Z")

</div>

Everything works like a switch. Extend to Homebridge. When opening the door, the switch is on, when closing the switch is off.  
Here is the code from top to bottom if you look at my previous screenshot:

register-device-Virtual door:  
Category -Switch

* * *

set flow.door-state:  
msg.payload.payload.contact.contact

* * *

switch:  
Property - flow.door-state

1. is true
2. is false

* * *

switch (is true) Virtual door - on  
switch (is false) Virtual door - off

* * *

set flow.door-state:  
msg.payload.payload.power.powerState
