Yeelight binding, manual configuration for other subnet?

I’m really trying to avoid putting chinese things on my main LAN so I used VLAN on my router and created one subnet/LAN just for IOT. My OpenHab2 and chromecasts, TVs are on LAN1 and chinese stuff on LAN2.

Since discovery process uses broadcasting which does not (and should not) work between subnets I thought I can configure Yeelight manually. I used miio to get tokens and data and created a thing in
things file:

Thing yeelight:wonder:0x000000000XXXXXXX [ hostname="192.168.1.130", port="55443", deviceId="0x000000000XXXXXXX", token="xxxxxxxxx..."]

… unfortunatelly this does not work. Thing is reported “offline”. from my LAN1 I can telnet to yeelight on LAN2, on port 55443, and control the light. But OpenHab seems not to.

Is this possible to configure this way? I tried different things:

  • moved OpenHab to LAN2, discovered yeelight, moved it back … yeelight is offline again
  • searched for custom firmware for yeelight … none found
  • considered moving OpenHab permanently to LAN2… then I have ton of trouble configuring my chromecasts, receivers, tvs
  • considered activating wifi on OpenHab and connect that interface to LAN2, keeping eth0 to LAN1… haven’t followed this through but configuration -> system settings suggest I still have to choose ONE subnet to braodcast to?

Hello Mirko, did you figure it out ?

Hi, I also have the bulbs in another subnet and I can’t solve … How did you do it?
I would be very grateful to you, bye :wink:

I’m aware that his topic is rather old but since nobody posted a solution yet I allow myself to push this up again.

The yeelink bulbs seem to have a security feature built-in that denies any controls sent from a different subnet (with the exception of the cloud connection of course). However this can be easily fixed by using a SNAT rule in your router if this is supported by your vendor.

I use a unifi usg router which allows the definition of NAT rules in the config.gateway,json file. In case of unifi this rule would look like that:

{
    "service": {
		"nat": {
			"rule": {
				"6500": {
					"description": "MASQ requests to Yeelight",
					"destination": {
						"address": "10.9.50.16"
					},
					"log": "disable",
					"outbound-interface": "eth1.50",
					"protocol": "tcp_udp",
					"type": "masquerade"
				}
			}
		}
	}
}

Change destination address to the address of the bulb (you may also use a range like this "address": "10.9.50.16-10.9.50.20" if you have multiple bulbs in this subnet). Also change the outbound interface to the virtual VLAN interface that your bulbs are sitting in (usually eth1.<VLANID>). Also make sure that the rule id is not in use already but the auto generated SNAT rules start at 6000 so 6500 should usually be fine.

What this does is that when openHAB connects to the bulb the actual source ip of your openHAB instance is replaced with your gateway ip and thus the bulb sees a request from the same subnet. This way the communication is working fine without the need to use a cloud connection.