Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update toZigbee.js #3697

Merged
merged 1 commit into from Jan 18, 2022
Merged

Update toZigbee.js #3697

merged 1 commit into from Jan 18, 2022

Conversation

mwav3
Copy link
Contributor

@mwav3 mwav3 commented Jan 18, 2022

Update to make sure temperature settings to thermostats are a whole round number by adding math.round calculation

I discussed this problem on this issue - Koenkk/zigbee2mqtt#10619

The temperature being published to the thermostat needs to be a 4 digit whole number. The temperature is in celcius, and the decimal point is moved over two places to determine the whole number that is published to the thermostat. The prior calculation took the celcius temperature and just multiplied it by 100, but this was not always producing a whole number, resulting in log errors like in the log below where a value like 1944.0000000000002 was trying to be published and failed. This resulted in the thermostat's temperature not updating:

debug 2022-01-14 06:15:56: Received MQTT message on 'zigbee2mqtt/Upper Floor Heat/set' with data '{"occupied_heating_setpoint":19.44}'
debug 2022-01-14 06:15:56: Publishing 'set' 'occupied_heating_setpoint' to 'Upper Floor Heat'
error 2022-01-14 06:15:59: Publish 'set' 'occupied_heating_setpoint' to 'Upper Floor Heat' failed: 'Error: Write 0x000d6f000304c118/1 hvacThermostat({"occupiedHeatingSetpoint":1944.0000000000002}, {"sendWhenActive":true,"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'HARDWARE_FAILURE')'
debug 2022-01-14 06:15:59: Error: Write 0x000d6f000304c118/1 hvacThermostat({"occupiedHeatingSetpoint":1944.0000000000002}, {"sendWhenActive":true,"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'HARDWARE_FAILURE')
    at Endpoint.checkStatus (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:310:23)
    at Endpoint.write (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:392:22)
    at Object.convertSet (/app/node_modules/zigbee-herdsman-converters/converters/toZigbee.js:1278:13)
    at Publish.onMQTTMessage (/app/lib/extension/publish.ts:246:36)
info  2022-01-14 06:15:59: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"Publish 'set' 'occupied_heating_setpoint' to 'Upper Floor Heat' failed: 'Error: Write 0x000d6f000304c118/1 hvacThermostat({\"occupiedHeatingSetpoint\":1944.0000000000002}, {\"sendWhenActive\":true,\"timeout\":10000,\"disableResponse\":false,\"disableRecovery\":false,\"disableDefaultResponse\":true,\"direction\":0,\"srcEndpoint\":null,\"reservedBits\":0,\"manufacturerCode\":null,\"transactionSequenceNumber\":null,\"writeUndiv\":false}) failed (Status 'HARDWARE_FAILURE')'","meta":{"friendly_name":"Upper Floor Heat"},"type":"zigbee_publish_error"}'

Adding the additional Math.round makes sure that a whole number is published to the set point to eliminate this error.

Update to make sure temperature settings to thermostats are a whole round number by adding math.round calculation
@Koenkk Koenkk merged commit 7cc7863 into Koenkk:master Jan 18, 2022
@Koenkk
Copy link
Owner

Koenkk commented Jan 18, 2022

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants