# Homekit-bridged + mDNS issue

**URL:** <https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594>\
**Category:** General\
**Created:** [6 November 2019 13:35 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594 "2019-11-06T13:35:57Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [23 November 2019 09:03 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/21 "2019-11-23T09:03:23Z")

</div>

Unfortunately you can't, but as a workaround for example I have some homekit only devices that communicate via bluetooth, via homebridge mqtt i have set up switches that act like triggers. In short what I did: in homekit automations, if homekit-only device turns on then trigger the homebridge switch and vice versa: If homebridgemqtt switch turns on, then switch the real homekit device on.

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [23 November 2019 10:04 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/22 "2019-11-23T10:04:57Z")

</div>

Thanks for the quick reply!  
Yep-I just tried what you said, works fine. Bit harder to do with the temp-sensor;-)

Thanks again👍

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [23 November 2019 10:11 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/23 "2019-11-23T10:11:26Z")

</div>

> [@sapster77](#):
>
> Specifically I have a door sensor and a temp sensor, whose data I would like to get into homebridge and then send out via homebridge/from/# topic .

You can use the technique as @bakman2 described or depending on the sensors you are using additionally connect them to node-red. E.g. all my temperature/humidity, window contact, motion sensors (xiaomi) are connected to node-red via [xiaomi-mqtt](https://github.com/cflurin/xiaomi-mqtt).

I also use philips hue which supports homekit and additionally node-red-contrib-huemagic.

Which sensors are you using?

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [23 November 2019 11:02 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/24 "2019-11-23T11:02:56Z")

</div>

Well, the sensors I am referring to are Elgate eve door sensor and eve degree sensor.

I have z-wave sensors on the other doors, but am trying to get rid of the z-wave altogether as I think it is too unreliable and maintenance intensive.

Therefore I got the eve sensor as I would like to go the homekit (and homebridge) way, but I hadn't thought of this issue beforehand.  
I have only bought 1 eve door sensor so far, so I can still change the plan. I have no experience with xiaomi - are they ok?

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [23 November 2019 11:23 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/25 "2019-11-23T11:23:38Z")

</div>

> [@sapster77](#):
>
> I have only bought 1 eve door sensor so far, so I can still change the plan. I have no experience with xiaomi - are they ok?

I'm using xiaomi devices for months and I'm very happy.

There are several ways to add xiaomi devices to node-red. I use the xiaomi-gateway via xiaomi-mqtt.  
At the moment I've approx. 30 devices (sensors).

Compared with other devices the price is amazing! see aliexpress.

Edit:

By the way I also use zwave and enocean but my intention is to replace them all and go this way:

a) xiaomi for sensors and generally input devices with battery.  
b) esp8266 based devices like sonoff and shelly for actuators.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [23 November 2019 12:00 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/26 "2019-11-23T12:00:38Z")

</div>

A picture to show the idea

 ![homebridge](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/80204a0637f0f0154d51bd5720ef160b3894b0ab.jpeg)

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [23 November 2019 12:45 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/27 "2019-11-23T12:45:06Z")

</div>

Ah - nice! Thanks - think I am going to go that way too. Just checked the price of the Xiaomi - it is like half price of the eve door sensors...nice:-)

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [23 November 2019 14:34 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/28 "2019-11-23T14:34:22Z")

</div>

One last thing...🙂  
Got my current temperaturesensor coming into node-red via openhab and now I am trying to get that into homebridge via mqtt. On all the other items it has worked fine since they have all been either/or. E.g a switch or a door, so I can use a switch and a change node, to get it into the correct format for mqtt.  
But how does it work with a variable, like temperature?  
 ![02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2be53ac5cc36ed21cf8747e941b48953f2a519f5.png)  
The payload in the above is like this

```auto
{"name":"Terrasse_L","service_name":"Terrasse_L","characteristic":"On","value":true}

```

But can't really figure out how to do it with temperature? I have added a temperature service like this.

```auto
{"name":"Temperatur","service":"TemperatureSensor"}

```

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [23 November 2019 16:09 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/29 "2019-11-23T16:09:34Z")

</div>

> [@sapster77](#):
>
> But can't really figure out how to do it with temperature? I have added a temperature service like this.
> 
> ```auto
> {"name":"Temperatur","service":"TemperatureSensor"}
> 
> ```

e.g. temp = 20.5

topic:

```auto
homebridge/to/set

```

payload:

```auto
{"name":"Temperatur","service_name":"Temperatur","characteristic":"CurrentTemperature","value":20.5}

```

Edit:

Note: you didn't define the `service_name` when you added the accessory, so the default is the same as the name.

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [23 November 2019 17:34 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/30 "2019-11-23T17:34:40Z")

</div>

Ah of course-thanks, that works😃  
The temperature from the sensor is output as a string- in this case something like “20.5”.

Since that value can vary, can i use a change node, to get that into the above format?  
With on/off it was easy since I knew it was either/or -in this case the temp is like X (unknown).

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [23 November 2019 18:41 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/31 "2019-11-23T18:41:35Z")

</div>

You can insert a `template` between the sensor output and the `mqtt-out`:

```auto
{"name":"Temperatur","service_name":"Temperatur","characteristic":"CurrentTemperature","value":{{payload}}}

```

But this is really node-red basic, so you should invest some time to learn node-red 😉

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [23 November 2019 18:57 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/32 "2019-11-23T18:57:51Z")

</div>

Jep - know what you mean. Going through the forums now - thanks again for all your help:-)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [23 November 2019 19:38 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/33 "2019-11-23T19:38:04Z")

</div>

Don’t forget to look at the excellent documentation.

---

<div class="post-metadata">

**Author:** ![bohtho](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bohtho/32/6153_2.png) [@bohtho](https://discourse.nodered.org/u/bohtho)\
**Post date:** [2 December 2019 09:23 UTC](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594/34 "2019-12-02T09:23:25Z")

</div>

That's pretty much my setup too @cflurin, except for zigbee2mqtt instead of xiaomi-mqtt and xiaomi-gateway (the latter replaced by TI's CC2652R1). In addition I have Sonoffs flashed with Tasmota (MQTT) and also a Modbus-to-wifi (MQTT) gateway.

Have you elegantly solved converting the different MQTT devices to Homebridge-MQTT somehow ? Or is that a manual process when a new device is added ?

I am asking because it's tempting to use Redmatic-HomeKit (alternative to homekit-bridged in the topic) because of it's automatic creation of homekit accessories from zigbee-herdsman (if you use node-red-contrib-zigbee instead of external zigbee2mqtt (same core)), but my hope is to elegantly make my own converter from zigbee/MQTT to Homebridge-MQTT, because of the latter's stability and dynamic nature.

This in turn made me think of adopting the homie-convention for MQTT to standardise all info and states in MQTT and node-red, before attempting to automatically convert to Homebridge-MQTT.

EDIT: Didnt mean to hijack thread so started a new one for this: [Thoughts on a general Zigbee to Homebridge (HomeKit) converter](https://discourse.nodered.org/t/thoughts-on-a-general-zigbee-to-homebridge-homekit-converter/18742)

[Previous page](https://discourse.nodered.org/t/homekit-bridged-mdns-issue/17594.md?page=1)
