Sensors? I'd like to buy the < $5 ones, not the > $30 ones

From what I read, the indoor range is roughly 7 meters, depending on how many walls you have; outdoor range is much higher. Each gateway can only support 32 devices; need more gateways if you have more than that. It is also zigbee stuff so I guess you can probably connect gateways together. Most sensors are battery-based so they unlikely serve as repeater.

@vrorglub, after some research, I think the risk is somewhat acceptable. I am still uncomfortable, but the lower cost is too attractive There is a small window when we need the gateway to connect to the Internet to turn on dev mode. After that you can block it at the router. Subsequent pairings can also be done manually without the gateway to be online. Now, there is still a risk of it attacking to devices in the network or the router itself.

I plan to use this for dumb battery-based sensors such as motion sensors only. For other stuff, I am using ZWave device (e.g. the Inovelli ZW30 Wall Switch).

Let me know how you get on, please.
Especially if the gateway can work offline, I’ll be interested

You can for sure avoid using the HUB.
Bought a $9 Zigbee (+$10 for programmer) receiver of Aliexpress and using this https://github.com/Koenkk/zigbee2mqtt as openhab connectivity.

Happy with it so far and no chinese cloud.

2 Likes

Now that’s interesting!

@achileos
That is really cool. I took a quick look at the Koenkk project, and looks like lots of the config stuff is for HomeAssistant. Would you be able to share anything that is specific to OpenHab? I am pretty new with OpenHab; never used anything with mqtt.

In another thread, EU Zigbee dongle, people talked about the Xiaomi sensors dropping off the network after a little while (using the Zigbee binding). Do you have the same problem? It is quite interesting the way Koenkk works; look like they basically fake themselves as the coordinator.

Nothing to fancy here :slight_smile:

Number T_BE4E  "T Salon [%.2f °C]" <temperature> (gZigbee,T,gZT)       {mqtt="<[local:zigbee2mqtt/salon:state:JSONPATH($.temperature)]" }
Number H_BE4E  "Hum Salon [%.2f %%]" <humidity> (gZigbee,Hum,gZHum)   {mqtt="<[local:zigbee2mqtt/salon:state:JSONPATH($.humidity)]" }

Number Batt_P_Entree  "BATT Porte Entree [%.1f %%]"  <battery>  (gBatt)   {mqtt="<[local:zigbee2mqtt/pEntree:state:JSONPATH($.battery)]" }

local being the name of mqtt broker, what’s after is topic name. You can rename devices on json config file “friendly_name” key.

I didn’t do the contacts yet/occupancy sensors as I’d need a proxy item (True,false vs Open/Closed) and have no use for it right now.

You could just use a MAP transform or a Javasript transform and then you don’t need the proxy item

You might want to see Stefan’s post Linear HUSBZB-1 and Xiaomi temp sensor - #8 by shauser88 where there is a comment on how to hack the Zigbee binding to deal with Xiaomi. I had the problem of them dropping off and switched to using the gateway (and disabling the gateway’s access in my router). That is working fairly well for now, but I would like to use a non-gateway solution if possible.

I’m already using JSONPATH to extract the data, some time ago we couln’t chain transforms didn’t retry since then, does it now work ?

@achileos,
No we can’t still nest transforms, but you can use a javascript transform that can do it all.

Ok RTFM Time :slight_smile:

Give me your json and the outputs you want,
I’ll send you a sample

Occupancy :

 2018-6-5 06:38:37 INFO MQTT publish, topic: 'zigbee2mqtt/dSalon', payload: '{"battery":"100.00","voltage":3035,"occupancy":true}'

Contact

2018-6-5 06:39:04 INFO MQTT publish, topic: 'zigbee2mqtt/pEntree', payload: '{"contact":false,"battery":"100.00","voltage":3025}'
2018-6-5 06:39:07 INFO MQTT publish, topic: 'zigbee2mqtt/pEntree', payload: '{"contact":true,"battery":"100.00","voltage":3025}'

And occupancy is a Switch?

occupancy.js

(function(jsonString) {
var data = JSON.parse(jsonString);
var value = data.occupancy;
var output = "NULL";
if (value) {
     output = "ON";
} else if (!value) {
     output = "OFF";
}
return output;
})(input)

contact.js

(function(jsonString) {
var data = JSON.parse(jsonString);
var value = data.contact;
var output = "NULL";
if (value) {
     output = "OPEN";
} else if (!value) {
     output = "CLOSED";
}
return output;
})(input)

Ok wait, I managed to break my OpenHAB but missing semicolon after NULL; and I guess true and false shouldn’t be quoted as they aren’t in json data. Be back soon.

I changed the scripts

(function(jsonString) {
var data = JSON.parse(jsonString);
var value = data.contact;
var output = "NULL";
if (value == true) {
     output = "CLOSED";
} else if (value == false) {
     output = "OPEN";
}
return output;
})(input)

Works as expected. Thanks.

I couldnt avoid, commenting on this one.

I use quite a few Xioami, sensors around my house, but not with any of the mentiond gateways, what I use is an Rasbee addon card for RaspberryPi from a German company with the name Dresden Electronics. I use it with Xiaoami Sensors, Philips hue lamps, Ikea Trådfri bulbs, lamps, switches and sensors. And for reliability i have had ONE Xioami sensor fail on me, but that was after it had fallen of the shelf where I had put it (to test), and the cats got hold of a small temperature sensor and used it as an hockey puck, so I guess it really doesnt count :slight_smile:

Annyway the solution is basicly configured like this -
Bulbs and lamps integradet to OH with the hue binding, as the DeconZ software emulates the RestApi of the hue gateway, Sensor values i have integrated using via websocket to NodeRed that reports to MQTT, and with openhab subscribing to the values. Sensor battery values get hold of using the http Binding asking the Rest Api directly every half an hour.

The mqtt solution i found here (i think) https://github.com/dresden-elektronik/deconz-rest-plugin/issues/159

The raspbee solution supports up to 200 devices.

/Ole, not in any way afiliated with Xioami, Ikea or Dresden elektronics…

I blocked the gateway’s MAC address from making outbound connections in my firewall after the initial setup and it works fine without being able to talk to the server.

1 Like