KartoffelToby / better_thermostat

This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.
https://better-thermostat.org
GNU Affero General Public License v3.0
759 stars 121 forks source link

SPZB0001 with FW 22190930 doesn't work, how to upgrade #74

Closed Se7enair closed 2 years ago

Se7enair commented 2 years ago

Prerequisites

configuration.yaml

climate:
  - platform: ai_thermostat
    name: wohnzimmer_heizung_rechts_ai
    unique_id: 1637927441
    thermostat: climate.wohnzimmer_heizung_rechts
    temperature_sensor: sensor.wohnzimmer_temperatursensor_temperature

Description

ai_thermostat does not change the local_temperature_calibration. But no errors.

Steps to Reproduce

  1. Install ai_thermostat via HACS and add the new climate entity

  2. Restart and wait for ai_thermostat to do something

Expected behavior:

adjustement of the local_temperature_calibration on the tvr

Actual behavior:

nothing happens

Versions

core-2021.11.5 z2m 1.22.1-1

Additional Information

I am unable to send the local_temperature_calibration manual via service

service: mqtt.publish
data:
  topic: zigbee2mqtt/wohnzimmer_heizung_rechts/set
  payload: >
    {
      "local_temperature_calibration":2
    }

results in

debug Received MQTT message on 'zigbee2mqtt/wohnzimmer_heizung_rechts/set' with data '{ "local_temperature_calibration":2 } '
debug Publishing 'set' 'local_temperature_calibration' to 'wohnzimmer_heizung_rechts'
error Publish 'set' 'local_temperature_calibration' to 'wohnzimmer_heizung_rechts' failed: 'Error: Write 0x00158d000369857b/1 hvacThermostat({"localTemperatureCalibration":20}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'INVALID_VALUE')'
info MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"Publish 'set' 'local_temperature_calibration' to 'wohnzimmer_heizung_rechts' failed: 'Error: Write 0x00158d000369857b/1 hvacThermostat({\"localTemperatureCalibration\":20}, {\"timeout\":10000,\"disableResponse\":false,\"disableRecovery\":false,\"disableDefaultResponse\":true,\"direction\":0,\"srcEndpoint\":null,\"reservedBits\":0,\"manufacturerCode\":null,\"transactionSequenceNumber\":null,\"writeUndiv\":false}) failed (Status 'INVALID_VALUE')'","meta":{"friendly_name":"wohnzimmer_heizung_rechts"},"type":"zigbee_publish_error"}'
KartoffelToby commented 2 years ago

Looks like your z2m itself has a problem if you can't set the local_temperature_calibration.

Is it linked correctly?

Se7enair commented 2 years ago

How can I check that? I am new to z2m. The Thermostat is working properly. I can set target_temperature etc. via mqtt, z2m or homeassistant.

I have another Thermostat which is accepting the temperature_calibration. It has another Firmware. Do you discovered any problems with different firmwares?

Not working: Firmware Datum 20191014 Firmware Version 22190930

Working: Firmware Datum 20190408 Firmware Version 18181120

Se7enair commented 2 years ago

I think I remember that it worked on deconz. So it is possible and maybe a bug in z2m.

KartoffelToby commented 2 years ago

This didn't work with deconz,

you can try the follow in Z2M to test if the TRV is working:

Go to the device detail page, and change the calibration, then check the logs of Z2M if any errors appear

Se7enair commented 2 years ago

Possible that tested it in deconz only with the one which is working?!

Errorlog From z2m

`Error Publish 'set' 'local_temperature_calibration' to 'esszimmer_heizung_links' failed: 'Error: Write 0x00158d00032f606e/1 hvacThermostat({"localTemperatureCalibration":30}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (no response received)' 
KartoffelToby commented 2 years ago

Looks like its not paired correctly, is it possible that the trv ist still connected to your deconz instance?

its only possible to pair it to deconz or z2m

Se7enair commented 2 years ago

Deconz is disabled, deleted and the conbee is working for z2m. But I have read that reconnecting may help. Wanted to try this anyway. I'll left you know as soon as I've tried it.

Se7enair commented 2 years ago

Tried 5x, it still shows the same error. Try a firmware update.

KartoffelToby commented 2 years ago

Can you control the target temp in Z2M for the TRV? Its really strange, if you can't control anything with Z2M directly this is an issue thats related to Z2M not my Intigration

Se7enair commented 2 years ago

I can control the target temp in z2m. I also think it is related to z2m, but I was hoping you have experience with this and can help me.

Firmwareupdate with deconz stucks. z2m claims that there is no image available.

In the meantime I tried a few times to change the calibration, the error shows "invalid_value". No matter if I try it via z2m or mqtt.

KartoffelToby commented 2 years ago

i have 3 Spirits i remember that i Update the Firmware over deconz last year Checkout this https://github.com/EUROTRONIC-Technology/Spirit-ZigBee

Se7enair commented 2 years ago

I tried it, but it stays on Idle and never starts. I think there is a version which cannot be updated. ordered three brand new thermostats which are arriving tomorrow. Curious about the if they will work.

KartoffelToby commented 2 years ago

It must be possible to make it work, you said setting offsets was possible in deconz, so it must be possible in z2m too, they make changes in the last release on the calibration values, so try a older version, or open a issue based on this problem in z2m

Se7enair commented 2 years ago

I tried it again with deconz with a thermostat which is also not working in z2m. This devices also doesnt work in deconz. So it is more related to the device itself.

I wrote a mail to the supplier, they already responded to me. They will change the affected devices to some which have a newer firmware. There are many reports on github with a faulty firmware. But I was unsure, because everything worked, except the calibration. But this was one of the main reasons I choose this thermostats.

Keep you informed as soon as the new thermostats arrive.

KartoffelToby commented 2 years ago

Just for the protocol:

I have two working with:

Firmware Datum 20190408 Firmware Version 18181120

Also one with Firmware Datum 20191014 Firmware Version 22190930

its also working, so its really boring looks like the same FW as yours, but isn't.

As in this post discribed https://github.com/EUROTRONIC-Technology/Spirit-ZigBee/releases/tag/20190408 there was two FW with the same datecode.

If its unflashable with e.g. deCONZ you must return it.

I also find Z2M should add the fixed FW to the OTA

Se7enair commented 2 years ago

I bought 3 new ones so that I can equip all the radiators. All of them contains Firmware 22190930. But the new version, because everything is running fine. To replace the old ones I need a invoice or something, but i bought a few of them used.

But now, I have four thermostats with working firmware. And they are working as expected with your code. 👍😊

current_temperature matches with temperature from the external sensor: image

radiator next to the first, current_temperature does not match: image

If ok, will keep this open, till I flashed the used ones. So that everbody can read here.

KartoffelToby commented 2 years ago

thats nice, thank you, yes let it Open. i'll pin it and the calibration curve shoud be better in the Future, as you can read from the current releases, the current Z2M Version only allow full int calibration, thats off by 0.9 -0.9 °C

i allready have a PR open, and test it in my local System. works fine with the Spirit.

hope it will be in the next Version of Z2M

Se7enair commented 2 years ago

It is working and totally easy!

All the benefits go to @solvisit he discovered it!

Heres a little tutorial to open the thermostat.

Preparations: Download firmware https://github.com/Se7enair/eurotronic-spirit-zigbee-firmware/blob/main/firmware-20191014-22190930-new.bin

Download FlashTool https://www.nxp.com/downloads/en/software-development-kits/JN-SW-4107.zip

Buy FTDI-Adapter https://www.amazon.de/AZDelivery-Adapter-FT232RL-Serial-gratis/dp/B01N9RZK6I/ref=sr_1_4?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=14LG084JIJ26C&keywords=ftdi+usb+adapter&qid=1639419985&sprefix=FTDI%2Caps%2C183&sr=8-4

Buy jumper cables https://www.amazon.de/AZDelivery-Jumper-Arduino-Raspberry-Breadboard/dp/B074P726ZR/ref=pd_bxgy_img_1/260-6644889-2185025?pd_rd_w=Hhy88&pf_rd_p=289750ef-2548-403a-9263-64d1c3b3297e&pf_rd_r=TM6NYNTCMGHDZSP5DWKT&pd_rd_r=cb200faf-da4a-4d48-8b46-7aa264575059&pd_rd_wg=XXXUu&pd_rd_i=B074P726ZR&psc=1

  1. Pull out the batteries
  2. Open the thermostat
    • There is a ring at the backside, remove it gently 2021-12-13_17-22-27
  1. Remove the zigbee-board
  2. follow the instructions below
  3. be happy

It is possible to replace the broken 20191014 firmware with a good 20191014 (or any other version), opening the TVR and programming the chip, it is not particularly difficult. Steps:

  1. You need a working TVR from which extract the working firmware or getting the file from someone did it. I will post the firmware if Eurotronic will permit it.
  2. You have to download the flash programmer for JN5179: https://www.nxp.com/downloads/en/software-development-kits/JN-SW-4107.zip
  3. You need an FTDI adapter ( maybe it works with a serial to usb cable too, didn't tested)
  4. Open the TVR
  5. Take off the zigbee board
  6. Connect it to the FTDI (not connected to USB) (see the image for wiring, there is an old hw version with the connectors on the other side, they are just translated not mirrorerd)
  7. Connect the FTDI to USB while shortcircuiting the board (see image)
  8. Open a Windows console with "cmd" and go to the flash programmer directory (default:"C:\NXP\ProductionFlashProgrammer") 8a) To extract the firmware launch the command (if i remember correctly, read the help for tips): JN51xxProgrammer.exe -s COM8 -S internal -F firmware.bin 8b) To program the firmware on the chip launch the command: JN51xxProgrammer.exe -s COM8 -S internal -f firmware.bin You have to try a few times to get connection with the chip, sometimes it doesn't work at first try. The chip is entered in programming mode if it does not to send packets, you can check it on the FTDI leds. DSC_0041 1 DSC_0042 1 DSC_0044 1 DSC_0045 1 DSC_0047 1 DSC_0052 1 DSC_0053 1 DSC_0055 1
KartoffelToby commented 2 years ago

wow, your my men! Thanks for your super instructions, i'm sure this will help someone.

thanks for your Work!

KartoffelToby commented 2 years ago

@Se7enair What do you think about create a wiki page of your work here?

Se7enair commented 2 years ago

Sounds good. I am propably not the only one with this problem. But I think I will need a little bit support with the wiki itself. Or how do you plan to create the wiki?

Valbx commented 2 years ago

Hello, I'm trying to flash my TVR with but I have no communication when I plug the USB. There is light, I can see the COM is ok, but nothing else. I think I'm missing something. I'm using a CP210x to UART adaptor.

@Se7enair, could you give more informations about the point "7.Connect the FTDI to USB while shortcircuiting the board (see image)" please ? What do we have to short-circuit on the board ?

maniacmanfred commented 2 years ago

I have the exact same problem as Valbx. Please give us some hint

Se7enair commented 2 years ago

Take a look here https://github.com/EUROTRONIC-Technology/Spirit-ZigBee/issues/1#issuecomment-1006549414

KartoffelToby commented 2 years ago

I create a wiki page for this: https://github.com/KartoffelToby/ai_thermostat/wiki/SPZB0001-with-FW-22190930-doesn't-work,-how-to-upgrade

if any other infos needed let me know or provide a Markdown i'll update the wiki

sygys commented 2 years ago

Does this also fix the trv_mode issue? Every few hours my SPZ0001 seems to resets itself to trv_mode 2 and closes or opens the valve automatically. going back to temperature controlled. It needs to stay in valve mode. im on Firmware 22190930.

I bought these valves because they are the only ones with zigbee that have a valve % control function. so i can manually set the valve. But when these things keep resetting the TRV mode back to 2 after sometime these are useless too

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity.

bluenazgul commented 1 year ago

updating worked fine, but now my Device is flashing red since about one Hour @Se7enair any tips?

Edit: 30min after this post the Device is back but still shows 20190408-18181120

sygys commented 1 year ago

Just sell the damn things and buy the zwave ones. I also have 1 Shelly trv using wifi which does a tremendous job and also has direct valve control. These eurotronic garbage isn't worth the money. And contacting eurotronic has no use whatsoever. They just don't give a shit that their software is crap

Se7enair commented 1 year ago

Yes, I would never by a new one. But I have 8 of them running. And they are doing what I want. Except if I use them with BT. For me thats fine.