Closed p11max closed 1 year ago
You can keep this in your external converter, e.g.:
const fzLocal = {
humidity: {
cluster: 'msRelativeHumidity',
type: ['attributeReport', 'readResponse'],
options: [exposes.options.precision('humidity'), exposes.options.calibration('humidity')],
convert: (model, msg, publish, options, meta) => {
const humidity = parseFloat(msg.data['measuredValue']) / 100.0;
const property = postfixWithEndpointName('humidity',msg,model,meta);
// https://github.com/Koenkk/zigbee2mqtt/issues/798
// Sometimes the sensor publishes non-realistic vales, it should only publish message
// in the 0 - 100 range, don't produce messages beyond these values.
if (humidity >= 0 && humidity <= 100) {
return {[property]: calibrateAndPrecisionRoundOptions(humidity, options, 'humidity')};
}
},
},
}
and then in the fromZigbee
section of your device use fzLocal.humidity
instead of fz.humidity
Thanks for tip and the quick answer. It's working. I just had to add const utils = require('zigbee-herdsman-converters/lib/utils');
and replace postfixWithEndpointName and calibrateAndPrecisionRoundOptions by utils.postfixWithEndpointName and utils.calibrateAndPrecisionRoundOptions
I close the issue. Thanks one more time.
p11max
Hello,
I made a gardening device which measures humidity and activates relays to water plants. Each device has 4 relays (fromzigbee.on_off) and 4 sensors. So I have 4 EndPoints, each one having 1 relay and 1 sensor. I made a custom converter (using multiEndpoint). When using only the relays I had no problem. But when using the humidity sensors, I had some errors.
I did some digging and realize that fromzigbee.humidity didn’t have the property postfixWithEndpointName.
I modified the fromZigbee.js file localy and it worked.
Is it possible to modify fromZigbee.js file?
Here are the modifications I made to fromZigbee.humidity:
Soil_moisture could also be modified, as it’s actually what I should have used.
Thanks for having a look and checking if it could be implemented.
p11max