home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.03k stars 29.12k forks source link

Pentair Integration - Salt Chlorine Generator Binary Sensor Not Working #95494

Closed virtualbitzz closed 9 months ago

virtualbitzz commented 1 year ago

The problem

There's an entity binary_sensor.pentair_0e_aa_40_scg_status, which I believe is the salt chlorine generator duty cycle. These generators work like a PWM fan. You set the duty cycle and they cycle on and off to meet the desired output. I think this binary sensor is supposed to indicate when the generator is actually running or not.

I've never seen this binary sensor actually turn on. I can go outside and look at the LED on the generator itself and watch it switch on and off, but the sensor never switches on, it just always indicates that it's off.

Looking at the diagnostic I see this section. scg_status has a value of 128 when the duty cycle is set to 100, and a value of 129 when it's set to 0.

Diagnostic from when duty cycle is set to 100%

  "scg": {
    "scg_present": 1,
    "scg_status": {
      "name": "SCG Status",
      "value": 128
    },
    "scg_level1": {
      "name": "Pool SCG Level",
      "value": 100,
      "unit": "%"
    },
    "scg_level2": {
      "name": "Spa SCG Level",
      "value": 0,
      "unit": "%"
    },
    "scg_salt_ppm": {
      "name": "SCG Salt",
      "value": 3500,
      "unit": "ppm",
      "state_type": "measurement"
    },
    "scg_flags": 128,
    "scg_super_chlor_timer": {
      "name": "SCG Super Chlorination Timer",
      "value": 0,
      "unit": "hr"
    }
  }
},

Diagnostic from when duty cycle is set to 0%

  "scg": {
    "scg_present": 1,
    "scg_status": {
      "name": "SCG Status",
      "value": 129
    },
    "scg_level1": {
      "name": "Pool SCG Level",
      "value": 0,
      "unit": "%"
    },
    "scg_level2": {
      "name": "Spa SCG Level",
      "value": 0,
      "unit": "%"
    },
    "scg_salt_ppm": {
      "name": "SCG Salt",
      "value": 3500,
      "unit": "ppm",
      "state_type": "measurement"
    },
    "scg_flags": 128,
    "scg_super_chlor_timer": {
      "name": "SCG Super Chlorination Timer",
      "value": 0,
      "unit": "hr"
    }
  }
},

What version of Home Assistant Core has the issue?

core-2023.6.3

What was the last working version of Home Assistant Core?

N/A

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Pentair

Link to integration documentation on our website

https://www.home-assistant.io/integrations/screenlogic

Diagnostics information

config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (1)-duty-cyle-0.json.txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json-duty-cycle-100.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @dieselrabbit, @bdraco, mind taking a look at this issue as it has been labeled with an integration (screenlogic) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `screenlogic` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign screenlogic` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


screenlogic documentation screenlogic source (message by IssueLinks)

dieselrabbit commented 1 year ago

Thank you for the detailed information, @virtualbitzz.

Question to help properly identify the value: If you set the pool duty cycle to 50%, do you see the value alternate between 128 and 129 and does it appear to be half the time at 128 and half at 129?

Basically I'd be looking for the value when the led on the SCG is on and off.

I don't have an SCG so it's been hard to nail down exactly what values mean what.

ha-debugger commented 12 months ago

Came here to report the same issue. Oddly, I see SCG Status has value opposite what was reported by OP

virtualbitzz commented 12 months ago

@dieselrabbit my apologies, I haven't been able to work on this since opening. @ha-debugger, would you be able to assist @dieselrabbit with testing?

ha-debugger commented 12 months ago

Yes, I would be happy to, was just about to comment on the screenlogicpy issue that I can help figure out the right codes with a little instruction (despite the username, I have no prior HA debugging experience). Shall I wireshark something?

dieselrabbit commented 12 months ago

That would be much appreciated, @ha-debugger.
I don't think wireshark is needed for SCG Status - the number alone is helpful when correlated to known states - but some of the other SCG super chlorination functionality in the linked issue could require it. We should chat there for those.

For SCG Status, a wider variety of state=number observations would be helpful.

virtualbitzz commented 12 months ago

I was able to play around with this a bit this morning. Mine is stuck on a status of 129 regardless of what the LED on the cell indicates. It may just be really slow for all I know. I was only giving it about 5 minutes between observing an LED status change and downloading a diagnostic.

Let me mess around with it a bit more today and see what I find.

virtualbitzz commented 12 months ago

I tried switching the duty cycle from 0% to 100% several times today, let it sit, then took a diagnostic. The SCG status value remains at 129. On every diag taken today.

I'm not sure what changed. The only changes I've made in the environment since opening this have been core upgrades, which I typically execute as soon as they're available.

config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (16).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (15).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (14).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (13).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (12).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (11).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (10).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (9).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (8).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (7).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (6).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (5).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (4).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (3).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (2).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json (1).txt config_entry-screenlogic-569fbeda1f6512a0ad008265bfdacbbd.json.txt

dieselrabbit commented 12 months ago

I appreciate the time spent on this.

5min should be plenty long enough for equipment state changes to propagate through the Pentair controller to the protocol adapter. Pump data seems to be the least frequently updated, but even then it's only ~30sec between updates.

I'm assuming that the screenlogic integration in Home Assistant had been updating normally during this time? If anything was unavailable, the diagnostic data would be stale. Either that or these flags do not operate at all like we thought.

Maybe comparing against the ScreenLogic2 desktop app would shed some light on this? (The mobile app doesn't have all the functionality of the desktop app). Barring that, confirming the indicator on the EasyTouch controller itself matches when you expect the scg is active? Should be an IntelliChlor Status indicator at the bottom below the Heater button.

virtualbitzz commented 12 months ago

Yea everything was updating normally, you can see the proper values in the debug.

I just checked back after the pool has been off all day and now the value is 128. I'll try again tomorrow and see what happens. Previously I was able to get this value to change by adjusting the duty cycle.

dieselrabbit commented 12 months ago

It's possible there's some significant delay in reporting the state to either the controller or to the ScreenLogic protocol adapter, though the protocol adapter is in theory on the same RS-485 com bus as all the other equipment, albeit wirelessly. If the controller knows, ScreenLogic should know. The desktop app would be a way to check for sure. It gets its data from the same endpoint the integration does.

While there is a seperate IntelliChlor tab in the interface, I don't know exactly what is reported. I'm hoping there is also something there to explain the persistent 0x80 (128) bit.

ha-debugger commented 12 months ago

My apologies, bit of an algae situation here, have been shocking with liquid chlorine so haven't run the salt cell. I have noticed however, that I have a 129 value now even when pump is off, so maybe it doesn't mean what we I initially thought. I do have a computer running the Pentair Screenlogic app, but that doesn't have any indicator for SCG status, just controls to set the duty cycle and super chlorinate timer.

dieselrabbit commented 12 months ago

I do think the value is a bitmask, and that 0x01 (1) and 0x80 (128) are separate flags, but you're right, maybe 1 doesn't mean active.

It's also possible that 129 was the last value when the pool pump shut off. I know that IntelliChem flags like "Dosing" or "Mixing" don't clear themselves after the pump shuts off.

calisro commented 9 months ago
      "scg": {
        "scg_present": 11,
        "sensor": {
          "state": {
            "name": "Chlorinator",
            "value": 129
          },

This value does not change for me regardless of the real status of the scg. If it is in error, running, off, etc it remains 129 for me. Its never changed.