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


(Vincent Regaud) #21

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


(achileos) #22

Ok RTFM Time :slight_smile:


(Vincent Regaud) #23

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


(achileos) #24

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}'

(Vincent Regaud) #25

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)

(achileos) #26

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.


(Vincent Regaud) #27

I changed the scripts


(achileos) #28
(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.


(Ole Eide) #29

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…


(Steve Dowling) #30

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.


(YF) #31

@SteveDowling Yup I read about that too; that would be my second option. I am ordering both the gateway and the CC2531 USB sniffer (https://github.com/Koenkk/zigbee2mqtt/wiki/Getting-started). I am going to try the latter first; if it works, I wont’ even need to turn on the Xiaomi gateway.


(Christopher Smith) #32

I received my Gateway and sensors yesterday.
If you are using iOS (iPhone/iPad) as your setup device, Be advised that setting the gateway into developer mode is NOT AT ALL obvious. The binding docs were written with Android in in mind and when the docs say to press the version number several times to reveal the hidden menu, in iOS there is no version.

Much googleing finally revealed that I was to tap several times in BLANK SPACE in the lower part of the screen. Then the hidden menu is in Chinese. Here is the link I found

A nice you tube video is at

It works and now I get to write rules to turn on and off lights when a door opens and closes


Xi Home App. No "Developer Mode"
(Christopher Smith) #33

The gateway does have a China plug, so get an adapter if you are plugging into a non-China receptacle.


(Christopher Smith) #34

I ordered the RF Bridge and sensors. I wonder if the RF Bridge will somehow work with the “Universal Garage Door Remote Keypad” I bought 2 years ago


(Steve Dowling) #35

I’m pretty happy with the gateway itself. It’s really easy to add new devices to it and I use it as a speaker in my home office to alert me when a motion sensor has been triggered. It was minor pain to set up initially but after that it is very convenient and I’ve never had any issues with it. Just press the button on the side of the gateway three times and hold the button on the device for a bit to add new devices.

For me, the fact that it has a Chinese plug on it is actually a bonus because it’s the same plug as AU/NZ but upside down :slight_smile:


(Fastcar550) #36

Just put a second hub or a third, OpenHab can see every hub in my house. I just add the sensors to the correct hub and they show up in paperui. Also each hub can be used as a night light and siren.


(Johann Obermeier) #37

Try… It will NOT work when it uses rolling codes.


(Christopher Smith) #38

No rolling code, but I have no experience with this kind of hardware hacking


(YF) #39

@Oleide
I just saw your message now. That Rasbee card looks pretty cool. I love the advertised range of 500m. That would beat pretty much any hub/gateway/usb stick out there. The CC2531 USB sniffer I am ordering only has a range of ~30m. The software stack and initial setup look a bit intimidating however.


(Tom) #40

Can anyone confirm, through actual usage, that the range is really only 7m? That doesn’t seem very far.