Ylianst / ESP-IQ2020

Connect a Hot Tub with a IQ2020 control board to Home Assistant and make it smart. Monitor and control temperature, jets, lights, power usage and more.
Apache License 2.0
11 stars 0 forks source link

Protocol Decoding & Discussion #2

Open wolfson292 opened 1 month ago

wolfson292 commented 1 month ago

I've been working extensively on reverse engineering the IQ2020 firmware from a hex file found online, and have identified the RS485 address (0x1F) of their internet gateway and some of the functions. Followed you on Twitter, and happy to collaborate.

Commands from address 0x1F to IQ2020 at 0x01 have 2 bytes to identify the command, and optional additional bytes. I've identified the following so far.

Get Versions 0x01 0x00

[18:50:41][I][iq2020.component:097]: sendCmd_ 1F -> 01 Length:02 Operation:40 Data:01:00 Checksum:63
[18:50:41][I][iq2020.component:349]: readline_ Full Packet 01 -> 1F Length:17 Operation:80 RESP Data:01:00:57:52:34:2E:30:34:64:65:31:63:45:30:30:32:44:4B:34:2E:30:30:06 DataS:..WR4.04de1cE002DK4.00. Checksum:Valid 4D=4D

Get/Set Timestamps 0x02 0x4C Seconds ... if Seconds >60, don't set, just return values

[18:50:41][I][iq2020.component:097]: sendCmd_ 1F -> 01 Length:03 Operation:40 Data:02:4C:FF Checksum:B0
[18:50:41][I][iq2020.component:349]: readline_ Full Packet 01 -> 1F Length:0A Operation:80 RESP Data:02:4C:37:12:11:0B:08:D1:07:01 DataS:.L7....... Checksum:Valid C1=C1 SinceLast:0.3s

Get lots of data 0x02 0x55

[18:50:41][I][iq2020.component:097]: sendCmd_ 1F -> 01 Length:02 Operation:40 Data:02:55 Checksum:B9
[18:50:41][I][iq2020.component:349]: readline_ Full Packet 01 -> 1F Length:75 Operation:80 RESP Data:02:55:00:08:40:04:00:00:06:04:00:0A:06:20:72:13:00:20:1C:20:1C:20:1C:84:03:60:54:00:00:00:00:31:30:32:46:10:66:09:00:C0:1C:06:00:61:A5:D9:02:1D:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:21:A3:06:00:02:00:2C:A4:D9:02:00:00:00:00:00:00:00:00:31:30:30:46:31:30:32:46:78:00:07:01:07:01:00:00:00:00:00:00:00:00:00:00:00:00:3A:00:00:00:00:00 DataS:.U..@........ r.. . . ...`T....102F.f......a............
fricker-ben commented 3 weeks ago

@fricker-ben I see the problem, working on it.

Thank you for your very quick response!

Ylianst commented 3 weeks ago

@npinguin ACE uses completely different commands. I don't have a ACE system, however, I will open a new issue for you, just like I did for #4. If you feel up to it, you can send me traffic captures and I will add support for it. I will finish up with @fricker-ben and get that done.

Ylianst commented 3 weeks ago

@fricker-ben I just put in a fix for Celsius for the climate control and updated the main page. In the climate section of the ESP home configuration, add the line celsius: true like this. Leading spaces to align with name is important.

climate:
  - platform: iq2020
    name: Temperature
    celsius: true

Since I just did the change in GitHub, you can force the ESP Home add-in to check for updates by adding refresh: 30s to the external_components section like this:

external_components:
  - source: github://ylianst/esp-iq2020
    refresh: 30s

Put in the two lines, update your ESP32 device over WIFI and it should start working. It's not just the .5 step, the min/max temperatures in Celsius are also a bit different and needed fixing.

image

Also, can I have your hot tub model, version string and what if any extra modules you have? ACE/Freshwater/Music? I am trying to keep track of what is working and what is not. Let me know if this fix works for you. Thanks!

Ylianst commented 3 weeks ago

@npinguin - Seems you like having access to a lot of sensors. I added instructions to add the WIFI signal strength sensors. Maybe you are interested in this.

fricker-ben commented 3 weeks ago

@Ylianst - Thank you, the temperature set point now acts as expected. It's a 2015 Hot Spring Sovereign, no extra modules. Version: 1.08.D0172E002HL1.02

npinguin commented 3 weeks ago

@npinguin - Seems you like having access to a lot of sensors. I added instructions to add the WIFI signal strength sensors. Maybe you are interested in this.

Thanks :-)

wifi signal is indeed poor waiting for my outdoor Unifi access point to improve the signal ;-)

Ylianst commented 3 weeks ago

Excellent. Thank you @fricker-ben. That was a really important fix and thank you for that version string, your the oldest version of the firmware I know about that it still works! This is excellent news. I was concerned that older firmwares would not work or need changes, but it seems not. Nice!!

@npinguin - I just added #6 for you. Let me know if you have any questions. I hope my instructions are clear and it should be simple.

fricker-ben commented 3 weeks ago

@Ylianst - All seems to be working very well, although my life time runtime is displaying as approx 29.22 years (921453056 seconds), which I think it a little off! All other runtimes seem reasonable for the age of the Hot Tub.

Ylianst commented 3 weeks ago

@fricker-ben That is interesting. I will take note of this. The lifetime encoding is very basic with not much room for error, basically, the value is directly obtained from the hot tub. If you even want to investigate this further, you can send me a packet capture like #4 to see what is going on, but not something that is crucial.

fricker-ben commented 3 weeks ago

@Ylianst - Certainly not crucial! I will dig out a windows laptop at some point & do a packet capture for you. Always interesting to see what's going on, especially on the different (much older in my case) firmware versions.

Ylianst commented 3 weeks ago

You would be the first one to provide a v1 firmware package capture... interesting to see what change have been made since.

rabidfurball commented 2 weeks ago

I just installed the OEM Hot Springs connected spa kit on a 2023 HS Flair and am able to log into its hub and it does let me download several python scripts and driver files for accessing the hot tub serial interface. Would that be helpful?

Looking at the logs, here are all the settings and sensors it seems to expose regularly:

('compatibility_byte', 0), 
('control_box_error_zc_signal', False), 
('control_box_error_flow_signal_open', True), 
('control_box_error_flow_error', False), 
('control_box_error_probe_error', False), 
('control_box_error_config_error', False), 
('sys_state_temp_lock', True), 
('sys_state_spa_lock', False), 
('sys_state_jet_1_high', False), 
('sys_state_jet_2_high', False), 
('sys_state_clean', False), 
('sys_state_summer_time_mode', False), 
('sys_state_water_care', True), 
('sys_state_navigator_sync', False), 
('sys_state_jet_1_low', False), 
('sys_state_jet_2_low', False), 
('sys_state_circ', True), 
('sys_state_blower', False), 
('sys_state_jet_3_high', False), 
('sys_state_heater', 0), 
('peripheral_status_adv_lite', False), 
('peripheral_status_sp_audio', False), 
('peripheral_status_i_cast', False), 
('peripheral_status_free_pad', False), 
('peripheral_status_cd_player', False), 
('peripheral_status_rheodyne', False), 
('peripheral_status_sp_audio_2', False), 
('peripheral_status_mp3', False), 
('peripheral_status_video', False), 
('peripheral_status_chlorine', True), 
('peripheral_status_networking', True), 
('peripheral_status_frog', False), 
('peripheral_status_water_feature', False), 
('peripheral_status_mz_light', False), 
('peripheral_status_hpc', False), 
('peripheral_status_two_way_audio', False), 
('peripheral_status_ace_gen_3', False), 
('peripheral_status_wireless_audio', False), 
('lls_set_bits', 10), 
('model_type', 8), 
('output_configuration_multi_zone_exterior', False), 
('output_configuration_2_pump_system', True), 
('output_configuration_multi_zone_themes', False), 
('output_configuration_3_pump_system', False), 
('output_configuration_blower', False), 
('output_configuration_heater_service_mode', True), 
('output_configuration_blower_service_mode', False), 
('output_configuration_three_pump_concurrency', False), 
('pump_configuration', 241), 
('feature_configuration_pump_1_speed', False), 
('feature_configuration_pump_2_speed', True), 
('feature_configuration_24_hour_operation', False), 
('feature_configuration_display_blanking', True), 
('feature_configuration_extended_auxillary_key', False), 
('feature_configuration_degree_celcius', False), 
('feature_configuration_temp_dsp_set', False), 
('mz_light_configuration_zone_1', False), 
('mz_light_configuration_zone_2', True), 
('mz_light_configuration_zone_3', True), 
('mz_light_configuration_zone_4', False), 
('pump1_timeout', 7200), 
('pump2_timeout', 7200), 
('pump3_timeout', 7200), 
('blower_timeout', 900), 
('light_timeout', 21600), 
('pump1_speed', 0), 
('pump2_speed', 0), 
('pump3_speed', 0), 
('blower_speed', 0), 
('high_limit_temperature', '101F'), 
('heater_operation_seconds', 1770297), 
('pump1_operation_seconds', 588704), 
('time_in_service', 18416413), 
('lost_line_counter', 9), 
('stm_state', 0), 
('spa_lock_state', 0), 
('temp_lock_state', 1), 
('clean_lock_state', 0), 
('pump2_operation_seconds', 149370), 
('pump3_operation_seconds', 0), 
('blower_operation_seconds', 0), 
('light_operation_seconds', 4366929), 
('spa_state', 3), 
('spa_light_state', 0), 
('circ_pump_operation_seconds', 18416308), 
('jet_1_low_operation_seconds', 232900), 
('jet_2_low_operation_seconds', 0), 
('ctrl_head_set_temperature', '100F'), 
('ctrl_head_water_temperature', '101F'), 
('voltage_l1', 122), 
('voltage_heater', 251), 
('voltage_l2', 251), 
('voltage_jet3', 0), 
('current_l1', 0), 
('current_heater', 0), 
('current_l2', 0), 
('current_jet3', 0), 
('power_l1', 0), 
('power_heater', 62), 
('power_l2', 18), 
('power_jet3', 0), 
('daily_clean_cycle', 1), 
('filter_time_1', 60), 
('filter_time_2', 30), 
('hawk_status_econ', False), 
('hawk_status_circ', False), 
('pcb_temperature', 97), 
('peripheral_current', 101), 
('rtc_seconds', 49), 
('rtc_minutes', 18), 
('rtc_hours', 4), 
('rtc_date', 17), 
('rtc_month', 6), 
('rtc_year', 2001), 
('rtc_status', 1), 
('lls_ready_flash', False), 
('lls_power_and_ready_flash', False), 
('lls_power_flash', False), 
('lls_power_and_ready_on', True), 
('lls_power_on', False), 
('lls_power_and_ready_alter', False), 
('lls_power_and_ready_ace_err', False), 
('sys_state_light_intensity', 0), 
('hawk_status_filter', 0)

'mz_POL_light_intensity': 0, 
'mz_POL_color_state': 1, 
'mz_Exterior_light_intensity': 0, 
'mz_Accent_loop_speed': 0, 
'mz_24_hour_light_status': 1, 
'mz_Accent_wheel_status': 0, 
'mz_Main_loop_speed': 0, 
'mz_Main_wheel_status': 0, 
'mz_Main_light_intensity': 0, 
'mz_Accent_light_intensity': 0, 
'mz_model': 0, 
'mz_Exterior_color_state': 1, 
'mz_system_status': 0, 
'mz_Exterior_loop_speed': 0, 
'mz_version': 0, 
'mz_POL_wheel_status': 0, 
'mz_Accent_color_state': 1, 
'mz_POL_loop_speed': 0, 
'mz_Main_color_state': 1, 
'mz_Exterior_wheel_status': 0

'audio_radio_signal_strength': 0, 
'audio_play_pause_status': 0, 
'audio_power': 0, 
'audio_wireless_channel': 1, 
'audio_source_selection': 4, 
'audio_balance': 0, 
'audio_treble': 0, 
'audio_bass': 0, 
'audio_bluetooth_pairing': 0, 
'audio_subwoofer_volume': 11, 
'audio_volume': 25

'heat_pump_current_operational_status': 255,
'heat_pump_current_mode_setting': 255

dosing_state': 3,
'g3_sensor_data': 255,
'g3_chlor_test_data': 255,
'spa_size': 2,
'spa_usage': 4,
'g3_clrmtr_test_data': 0,
'salline_test': 72,
'g3_level2_errors': 0,
'g3_sensor_status': 255,
'g3_ph_test_data': 67
Ylianst commented 2 weeks ago

@rabidfurball Wow, nice. I also have the connected spa kit, but did not think I could log into the hub. How is that done? In any case, yes, this is super useful. I immediately recognize values here that I did not know the meaning of. For example, the timeout values, the PCB temperature/current and voltage on L1 and L2. I got more work to do based on this.

By the way, if you ever opt to add this ESP32 integration to your hot tub, note that it will auto-detect the polling of the connected spa kit and not do any polling of it's own. It will instead look at the data polled by the spa kit. If you disconnect the hub, the spa kit will stop polling and the integration will timeout and start polling on it's own again. So, in any case, ESP32 will play nice to the connected spa kit.

rabidfurball commented 2 weeks ago

@Ylianst Oh nice, I was seriously considering your diy approach but wasn't quite ready to commit to that as I primarily use Hubitat and haven't tinkered with home assistant too much. But good to know I could use both, may still try that!

To log in to the hub, just find its IP address, and then login in a browser with the username "python" and password written on the bottom of the hub. Once in, there is a file browser and you can download the python scripts used to connect the hub to the xbee spa dongle as well as to Watkins servers. The Watkins stuff isn't even compiled and shows their api key in the code... so I bet you could even get your script to connect to their app if you really wanted. The event and python logs are also pretty descriptive, which is where I got that channel listing in my earlier message. The logging is set to debug by default and the cpu load can be pretty high on that thing, disabling debug logging might actually increase performance.

The reason I looked into the hub in the first place is that my connected spa kit was misconfigured by hot springs from the box and wouldn't connect... They had set the autorun python script command as "dia.py and dia.yml" rather than "dia.py dia.yml" so it was looking for a config file called "and", failing, not installing the xbee driver, and rebooting the hub. Pretty dumb... but I fixed that and it started loading the correct configuration and working correctly.

Ylianst commented 2 weeks ago

@rabidfurball Thanks for all that valuable information. Wow, this is so much more interesting than I ever expected. Since you are not using Home Assistant, one idea I was thinking of is at some point hosting a tiny web site on the ESP32 itself with the data and control. The ESP32 is very limited so, I would probably put CSS and JavaScript files on GitHub in this repo so ESP32 would not need to serve them. In any case, I will take a look at the hub, absolutely fascinating.

Ylianst commented 2 weeks ago

@rabidfurball Wow. I logged in to the hub and indeed, saw the logs being written just as you described. I was able to improve my protocol decoding a lot based on this new information. I could capture my on decoding vs the decoding in the log for the exact same packet and compare, it's wonderful. I will be adding a bunch more diagnostics sensors in the next few days.

Ylianst commented 2 weeks ago

I just added a bunch of new sensors to the integration. New run times, voltage, currents, power, temperature. The one thing I wonder is that there is a "heater" voltage/current/power that is around 70 watts all the time for me. This is clearly not the main heater, but the official decoder does call it a "heater". I am not sure what that is. Is there a second small heater in the hot tub? Or is this a mislabeled sensor? In any case, many more values to look at. If you Jet 1 does not have a low setting, your Jet 1 low lifetime will be zero.

sensor:
    circulation_pump_total_runtime:
      name: Circulation Pump Runtime
    jet1_low_total_runtime:
      name: Jets 1 Low Runtime
    jet2_low_total_runtime:
      name: Jets 2 Low Runtime
    power_l1:
      name: Pump Power
    power_heater:
      name: Small Heater Power
    power_l2:
      name: Heater Power
    voltage_l1:
      name: Voltage L1
    voltage_heater:
      name: Voltage Heater
    voltage_l2:
      name: Voltage L2
    current_l1:
      name: Current L1
    current_heater:
      name: Current Heater
    current_l2:
      name: Current L2
    pcb_temperature:
      name: Controller Temperature
npinguin commented 2 weeks ago

works nicely, just do not understand the flag for celcius. I get the pcb temperature in farenheit and the other temps remain as they are

image image

Ylianst commented 2 weeks ago

Internally the PCB temperature is given in Farenheit, however, I have to look into this because I should try to give the temperature in the same units as the others, even if I have to convert it.

Interesting, my L1 voltage is 120v... I guess you are in Europe and everything is 220v.

You can comment out the Jet1 Low Runtime, you don't have that.

Ylianst commented 2 weeks ago

Ok. Just made the PCB sensor a _f_ or_c_ type of sensor, so you can configure it.

sensor:
    pcb_f_temperature:
      name: Controller Temperature
npinguin commented 2 weeks ago

Top, unfortunately with the latest update of esphome, the configuration does not work/compole anymore

Ylianst commented 2 weeks ago

@npinguin The latest ESP Home add-in has a breaking change, it's not related to this integration. If you are getting an error around the ota area, you need the add the line - platform: esphome in that section.

Old:

ota:
  password: "xxxxxxxxxxxxxx"

New:

ota:
  - platform: esphome
    password: "xxxxxxxxxxxxxx"

Keep the password as-is, just add the platform line and move the password line two spaces right. Let me know if that helps.

npinguin commented 2 weeks ago

top working perfectly

Ylianst commented 2 weeks ago

Ok... I did it. I got the ESP32 to emulate the Music module and route buttons back to Home Assistant. I just got this working hours ago and I am sure I will evolve this a lot more. Instructions here, feedback appreciated.

audio2

npinguin commented 2 weeks ago

Works perfectly, just had to switch power off and on

Ylianst commented 2 weeks ago

Thanks @npinguin. I just updated the instructions to mention that you need to reset the remote, there is a demonstration video here. That will help and does not require a full spa reset.

Ylianst commented 2 weeks ago

I just put in a major update for the audio module emulation. I lot more sensors now. The "audio_volume" sensor is now removed and the integration needs the following sections even when the audio module is it used.

select:
number:
text:

Updated audio instructions here.

Ylianst commented 2 weeks ago

Just added one more sensor that tracks the logo lights (green and blue) in front of the hot tub. You can see information on this new sensor at the top of the extras page.

joshs85 commented 2 weeks ago

My hot tub lights button flips through three stages, high med and low brightness and can also change colors. Any idea how to control this?

Ylianst commented 2 weeks ago

@joshs85 If your talking about the green/blue logo, I can't control that, I can only tell you what it's showing currently. If you are talking about the lights within the hot tub that can be controlled by the remote, I can turn them on/off (which should work) and I can tell you exactly which light is what color and brightness, but I can't control it (yet). It's possible there is a command to control lights colors and brightness, but have not found this yet.

joshs85 commented 2 weeks ago

@joshs85 If your talking about the green/blue logo, I can't control that, I can only tell you what it's showing currently. If you are talking about the lights within the hot tub that can be controlled by the remote, I can turn them on/off (which should work) and I can tell you exactly which light is what color and brightness, but I can't control it (yet). It's possible there is a command to control lights colors and brightness, but have not found this yet.

Its the lights inside of the hot tub. The switch in HA turns them on and off just fine. There's a setting on the control panel for brightness within settings (also the light button on the control panel cycles through the brightness low, med, high + off).. Then you can also set the color in the settings.

joshs85 commented 2 weeks ago

Great work on this by the way.. I had hooked up an atom lite + the rs485 base several months ago and finally had time to start trying to figure out the commands to control everything via the expansion port. I knew there was an internet connection thing hot springs sells but don't have one.. so I did one last search for it and you had already done it.. I deployed it and it works really well. Really loving esphome.

Ylianst commented 2 weeks ago

@joshs85 Ha yes, for the inside lights, I can see the exact status of them. I have not created any sensors for them yet, but I could. For example, you could make it so that other lights around your house match the color of the lights in your hot tub. I can't control them, but I could add these sensors so you can see the values if you like. Feel free to open a new issue requesting these if needed.

Ha thanks. Once I found the RS485 pins and did confirm that it worked and got the basic packet format and checksum, but did go ahead and buy the spa connection kit so I could get this project moving forward. I don't plan on ever using the connection kit, but it was well worth it for the benefit of the community. ESP-Home is amazing, i used it for my Rheem water heater and that got me started. There are still unknowns on the protocol. I don't have a real packet capture of the music module and I wish I did, I had to make up some stuff and in scanning for all commands, I did find a few I still don't know what they do. However, the basics are working really well.

joshs85 commented 2 weeks ago

@joshs85 Ha yes, for the inside lights, I can see the exact status of them. I have not created any sensors for them yet, but I could. For example, you could make it so that other lights around your house match the color of the lights in your hot tub. I can't control them, but I could add these sensors so you can see the values if you like. Feel free to open a new issue requesting these if needed.

Ha thanks. Once I found the RS485 pins and did confirm that it worked and got the basic packet format and checksum, but did go ahead and buy the spa connection kit so I could get this project moving forward. I don't plan on ever using the connection kit, but it was well worth it for the benefit of the community. ESP-Home is amazing, i used it for my Rheem water heater and that got me started. There are still unknowns on the protocol. I don't have a real packet capture of the music module and I wish I did, I had to make up some stuff and in scanning for all commands, I did find a few I still don't know what they do. However, the basics are working really well.

Yeah, if you could add the sensors that'd be cool. Which Rheem water heater do you have? I have a newer Rheem heat pump water heater with EcoNet.. I would love to dump their cloud service and move over to an esp32. Do you happen to have a link to that project?

For a sniffer, you can just use the uart port on an atom with the rs485 base. If you set dummy_receiver: true you can have it log all packets in both directions to the logs easily.. This is what I had setup on the same hardware hooked up to my hot tub before I deployed your code to it.

esphome:
  name: hot-tub-controller
  friendly_name: Hot Tub Controller

esp32:
  board: esp32dev
  framework:
    type: arduino

# You need a UART to talk to the RS485 bus
uart:
  id: my_uart
  baud_rate: 38400
  rx_pin: GPIO22
  tx_pin: GPIO19
  debug:
    direction: BOTH
    dummy_receiver: True
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_hex(direction, bytes, ',');

select:
  - id: change_baud_rate
    name: Baud rate
    platform: template
    options:
      - "2400"
      - "9600"
      - "38400"
      - "57600"
      - "115200"
      - "256000"
      - "512000"
      - "921600"
    initial_option: "115200"
    optimistic: true
    restore_value: True
    internal: false
    entity_category: config
    icon: mdi:swap-horizontal
    set_action:
      - lambda: |-
          id(my_uart).flush();
          uint32_t new_baud_rate = stoi(x);
          ESP_LOGD("change_baud_rate", "Changing baud rate from %i to %i",id(my_uart).get_baud_rate(), new_baud_rate);
          if (id(my_uart).get_baud_rate() != new_baud_rate) {
            id(my_uart).set_baud_rate(new_baud_rate);
            id(my_uart).load_settings();
          }

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: ! secret api_encryption_key

ota:
  - platform: esphome
    id: ota_password
    password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Hot-Tub-Controller"
    password: !secret fallback_wifi_pw

captive_portal:

button:
  - platform: uart
    name: "UART Bytes Output"
    data: [0x58,0x4d,0x53,0x00,0x03,0x6b,0x00,0x10,0x01,0x76] 
Ylianst commented 2 weeks ago

Ha. Funny you ask about the Rheem Heat Pump water heater, that is exactly what I have and I made a video about it, the project is EspHome-EcoNet and yes, it works so well, I don't use the cloud app anymore. I am a huge fan of that project and they use my video on their main page.

For the RS485 sniffer, yes, that is exactly how I got started with dummy_receiver: True, however I quickly needed something more powerful. You may have noticed that this integration as a built-in RS485-to-TCP relay and I built a C# app to decode the traffic. Take a look for the first post of #6 to see how it works. The C# app allowed me to send/receive data and conduct all sorts of experiments like trying all possible commands (64k of them), etc.

joshs85 commented 2 weeks ago

Do you know if this takes over control of the hot tub completely when its hooked up and running? I don't think my cleaning cycle has come on automatically since I hooked it up. it used to come on all the time by itself.

Ylianst commented 2 weeks ago

This integration does not take control and the cleaning cycle will happen as usual. I will note that if you have "Summer Timer" turned on, it may stop the cleaning cycle from happening, but not sure. In any case, you should see the 'cleaning cycle' turn on in the logs each time it happens.

Ylianst commented 2 weeks ago

@joshs85 I added the light intensity and color sensors, take a look at the extras here for information on adding them. Let me know if it works for you.

joshs85 commented 2 weeks ago

@joshs85 I added the light intensity and color sensors, take a look at the extras here for information on adding them. Let me know if it works for you.

hmm.. it works.. but when my lights are on the color cycle setting, I see 7 for the color instead of 8. The intensity seems to work. Here's what I added to the config

    lights_underwater_intensity:
      name: Underwater Light Intensity
    lights_underwater_color:
      name: Underwater Light Color
Ylianst commented 1 week ago

@joshs85 Can you speed up the polling rate like this:

iq2020-dev:
   uart_id: SpaConnection
   polling_rate: 10                          <----

Then, cycle thru all the colors and see what values to read for each of them? I will do the same later today and see if I the table I created is not right. I think these are my values... but will check again.

1 = Violet
2 = Blue
3 = Cyan
4 = Green
5 = White
6 = Yellow
7 = Red
8 = Color Cycle
joshs85 commented 1 week ago

@joshs85 Can you speed up the polling rate like this:

iq2020-dev:
   uart_id: SpaConnection
   polling_rate: 10                          <----

Then, cycle thru all the colors and see what values to read for each of them? I will do the same later today and see if I the table I created is not right. I think these are my values... but will check again.

I already have my polling time set to 5s. These are my results below. There's a separate setting for color loop 1-3 which doesn't affect the color that's set as far as I can tell.

7 = Violet
1 = Blue
2 = Cyan
3 = Green
4 = White
5 = Yellow
6 = Red
Ylianst commented 1 week ago

@joshs85 Color loops? Here is my color screen on my remote. Can you post what yours looks like?

colors1 colors2

joshs85 commented 1 week ago

If you set the color loop to 1,2, or 3, it will loop through a bunch of colors automatically and the color from your integration just stays on whatever color had been selected prior.

IMG_2240 IMG_2241 IMG_2242 IMG_2243 IMG_2244

Ylianst commented 1 week ago

Arg. This is very different indeed. If you install the DataViewer all and look at the lights status packet, you may have different values. If you decode your own usage, I could add ESP-Home sensors where needed and/or update the documentation to match your model. This where the findings for my model:

<-- 01 1F 40 1705
<-- 1F 01 80 17050005020202000000000000000005010101010000
                 FFAABBCCDD                WWXXYYZZOO

FF = Flags (0x01 = Lights Timer On)
AA = Underwater light intensity (0x05 = High ... 0x01 = Low, 0x00 = Off)
BB = Bartop light intensity
CC = Pillow light intensity
DD = Exterior light intensity
WW = Underwater light color     (0x01 = Violet, 0x02 = Blue, 0x03 = Cyan, 0x04 = Green, 0x05 = White, 0x06 = Yellow, 0x07 = Red, 0x07 = Color Cycle)
XX = Bartop light color
YY = Pillow light color
ZZ = Exterior light color
OO = 00 for lights are off, 01 for lights are on.
joshs85 commented 1 week ago

Eh... the windows client seems to crash as soon as I connect and get a single data packet.

joshs85 commented 1 week ago

If I connect really fast and then disconnect it seems to work

Lights on. Color loop 0 --> 01 1F 40 1705 <-- 1F 01 80 17050003000000000000000000000003010101010000

Lights on Color Loop 1 --> 01 1F 40 1705 <-- 1F 01 80 17050003000000010000000100000003010101010000 Lights on Color Loop 2 --> 01 1F 40 1705 <-- 1F 01 80 17050003000000010000000200000003010101010000 Lights on Color Loop 3 --> 01 1F 40 1705 <-- 1F 01 80 17050003000000010000000300000003010101010000

Ylianst commented 1 week ago

@joshs85 Arg! Thanks for letting me know. I bet I try to parse a packet and crash doing it. I will add more exception handling to fix this. I will need to add a new sensor for your color loop.

<-- 1F 01 80 17050005020202000000000000000005010101010000
<-- 1F 01 80 17050003000000010000000300000003010101010000
                 FFAABBCCDD        LL      WWXXYYZZOO

FF = Flags (0x01 = Lights Timer On)
AA = Underwater light intensity (0x05 = High ... 0x01 = Low, 0x00 = Off)
BB = Bartop light intensity
CC = Pillow light intensity
DD = Exterior light intensity
LL = Color Loop (NEW)
WW = Underwater light color     (0x01 = Violet, 0x02 = Blue, 0x03 = Cyan, 0x04 = Green, 0x05 = White, 0x06 = Yellow, 0x07 = Red, 0x07 = Color Cycle)
XX = Bartop light color
YY = Pillow light color
ZZ = Exterior light color
OO = 00 for lights are off, 01 for lights are on.
Ylianst commented 1 week ago

FYI. This integration is now in the ESP-Home devices list.

joshs85 commented 1 week ago

FYI. This integration is now in the ESP-Home devices list.

Yeah, I saw your pull request. Nice!

joshs85 commented 1 week ago

I used your other integration to hook up my hot water heater this morning. Works great!