Crewski / njsPC-HA

Home Assistant integration for nodejs-PoolController
29 stars 6 forks source link

Entities not reloaded after upgrade from 0.4.1 to 0.4.2 #21

Closed FlaMike closed 1 year ago

FlaMike commented 1 year ago

My pool has an EasyTouch 2.4 controller. I upgraded to 0.4.2 of nsjPC-HA from 0.4.1. I am running njsPC version 7.7.0. I restarted HA after the upgrade & reloaded the integration. Nearly all entities are unavailable for the pool. The integration lists 9 devices: EasyTouch 2 4, Filter, Inellibright, Intellichlor-20, Intelliflow VSF, Lights, njsPC-HA, Pool, and Spa. It allegedly has 58 entities, but most are dimmed & unavailable. I've checked each device to find the entities without luck.

In 0.4.1 most entities were under the njsPC-HA device, however, all are unavailable in 0.4.2. Intellichlor has entities, Pool has the heater, EasyTouch has Freeze Protect sensor, Intellibright has lighting controls, Lights has some lighting controls. There are no controls for pump on/off/speed, no switches for the cleaner or acid feeder. No switches for auxiliary circuits.

I downgraded back to 0.4.1 and everything returned to normal.

If I am experiencing pilot error, please correct me. If you need more details/info, please don't hesitate to ask.

Thank you!

Crewski commented 1 year ago

Hey @FlaMike, there was some pretty big changes to 0.4.2 and added a bunch of entities not previously discovered....which also mean more potential for problems. We'll work through these as they popup. Do you see any error in the logs? I'm guessing there will be one saying there is a KeyError somewhere.

Also, can you post your response to http://yourip:4200/state/all. That way we can match up the error with the config. Thanks.

FlaMike commented 1 year ago

I saw a bunch of new stuff, as you suggested. Re-upped to 0.4.2 & enabled logging, below is the log output.

2023-02-12 10:25:59.428 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up njspc_ha platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/njspc_ha/sensor.py", line 79, in async_setup_entry BodyTempSensor(coordinator=coordinator, units=units, body=body) File "/config/custom_components/njspc_ha/bodies.py", line 278, in init self._value = body["temp"] KeyError: 'temp' 2023-02-12 10:25:59.431 ERROR (MainThread) [homeassistant.components.switch] Error while setting up njspc_ha platform for switch Traceback (most recent call last): File "/config/custom_components/njspc_ha/switch.py", line 42, in async_setup_entry BodyCircuitSwitch( File "/config/custom_components/njspc_ha/bodies.py", line 362, in init self.circuit_name = circuit["name"] KeyError: 'name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/njspc_ha/switch.py", line 57, in async_setup_entry CircuitSwitch( File "/config/custom_components/njspc_ha/features.py", line 40, in init self.equipment_name = circuit["name"] KeyError: 'name'

FlaMike commented 1 year ago

state/all output below...

{"systemUnits":{"val":0,"name":"english","desc":"English"},"startTime":"2023-02-06T21:10:32.351+0000","time":"2023-02-12T10:35:05.000+0000","valve":0,"delay":{"val":0,"name":"nodelay","desc":"No Delay"},"batteryVoltage":0,"status":{"val":1,"name":"ready","desc":"Ready","percent":100},"mode":{"val":0,"name":"auto","desc":"Auto"},"appVersion":"7.7.0","appVersionState":{"gitLocalBranch":"master","gitLocalCommit":"8f49f63","installed":"7.7.0","status":{"val":2,"name":"ahead","desc":"Ahead of published version"},"nextCheckTime":"2023-02-12T21:12:13.014+0000","githubRelease":"7.6.1","equipmentType":"appVersion"},"clockMode":{"val":12,"name":"12 Hour"},"clockSource":{"val":1,"name":"manual","desc":"Manual"},"controllerType":"easytouch","model":"EasyTouch2 4","sunrise":"2023-02-12T12:28:04.000+0000","sunset":"2023-02-12T23:30:49.000+0000","alias":"","freeze":false,"valveMode":{"val":1,"name":"pool","desc":"Pool"},"temps":{"units":{"val":0,"name":"F","desc":"Fahrenheit"},"bodies":[{"id":1,"heaterOptions":{"total":1,"gas":1,"solar":0,"heatpump":0,"ultratemp":0,"hybrid":0,"maxetherm":0,"mastertemp":0},"isCovered":false,"heaterCooldownDelay":false,"startDelay":false,"stopDelay":false,"showInDashboard":true,"heatMode":{"val":0,"name":"off","desc":"Off"},"type":{"val":0,"name":"pool","desc":"Pool"},"temp":57,"isOn":true,"setPoint":86,"name":"Pool","circuit":6,"heatStatus":{"val":0,"name":"off","desc":"Off"},"coolSetpoint":81},{"id":2,"heaterOptions":{"total":1,"gas":1,"solar":0,"heatpump":0,"ultratemp":0,"hybrid":0,"maxetherm":0,"mastertemp":0},"isCovered":false,"heaterCooldownDelay":false,"startDelay":false,"stopDelay":false,"showInDashboard":true,"heatMode":{"val":0,"name":"off","desc":"Off"},"type":{"val":1,"name":"spa","desc":"Spa"},"isOn":false,"setPoint":94,"name":"Spa","circuit":1,"heatStatus":{"val":0,"name":"off","desc":"Off"}}],"waterSensor1":57,"air":53,"solar":0,"equipmentType":"temps"},"equipment":{"messages":[],"model":"EasyTouch2 4","controllerType":"easytouch","maxBodies":2,"maxCircuitGroups":32,"maxCircuits":4,"maxFeatures":8,"maxHeaters":16,"maxLightGroups":1,"maxPumps":2,"maxSchedules":12,"maxValves":4,"single":false,"shared":true,"dual":false,"equipmentType":"equipment","softwareVersion":"2.180","bootLoaderVersion":"1.010"},"pumps":[{"id":1,"status":{"name":"ok","desc":"Ok","val":0},"pumpOnDelay":false,"name":"Intelliflo VSF","address":96,"type":{"val":64,"name":"vsf","desc":"Intelliflo VSF","minSpeed":450,"maxSpeed":3450,"speedStepSize":10,"minFlow":15,"maxFlow":130,"flowStepSize":1,"maxCircuits":8,"hasAddress":true},"isActive":true,"command":10,"mode":9,"driveState":2,"watts":231,"rpm":1750,"flow":11,"ppc":10,"time":634,"equipmentType":"pump","minSpeed":450,"maxSpeed":3450,"minFlow":15,"maxFlow":130,"speedStepSize":10,"flowStepSize":1,"circuits":[{"id":1,"master":0,"circuit":{"id":6,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":2,"name":"pool","desc":"Pool","hasHeatSource":true,"body":1},"showInFeatures":true,"isOn":true,"name":"Pool","nameId":61,"endTime":"2023-02-12T20:01:59.000+0000","startTime":"2023-02-12T14:00:00.053+0000","equipmentType":"circuit"},"units":{"val":0,"name":"rpm","desc":"RPM"},"speed":1750},{"id":2,"master":0,"circuit":{"id":3,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":0,"name":"generic","desc":"Generic"},"showInFeatures":true,"isOn":false,"name":"Cleaner","nameId":22,"equipmentType":"circuit"},"units":{"val":0,"name":"rpm","desc":"RPM"},"speed":3450},{"id":3,"master":0,"circuit":{"id":15,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Pool High","type":{"val":13,"name":"generic","desc":"Generic"},"nameId":62,"equipmentType":"feature"},"units":{"val":0,"name":"rpm","desc":"RPM"},"speed":3450},{"id":4,"master":0,"circuit":{"id":129,"equipmentType":"virtualCircuit"},"units":{"val":1,"name":"gpm","desc":"GPM"},"flow":40}]}],"valves":[{"id":1,"name":"Drain Line","type":{"val":0,"name":"standard","desc":"Standard"},"isDiverted":false,"equipmentType":"valve","circuit":{"id":11,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Drain Line","type":{"val":13,"name":"generic","desc":"Generic"},"nameId":25,"equipmentType":"feature"},"isIntake":false,"isReturn":false,"isActive":true,"pinId":0},{"id":2,"name":"Valve B","type":{"val":0,"name":"standard","desc":"Standard"},"isDiverted":false,"equipmentType":"valve","circuit":{"id":0,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":0,"name":"generic","desc":"Generic"},"equipmentType":"circuit"},"isIntake":false,"isReturn":false,"isActive":true,"pinId":0},{"id":3,"name":"Intake","type":{"val":0,"name":"standard","desc":"Standard"},"isDiverted":false,"equipmentType":"valve","circuit":{"id":6,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":2,"name":"pool","desc":"Pool","hasHeatSource":true,"body":1},"showInFeatures":true,"isOn":true,"name":"Pool","nameId":61,"endTime":"2023-02-12T20:01:59.000+0000","startTime":"2023-02-12T14:00:00.053+0000","equipmentType":"circuit"},"isIntake":true,"isReturn":false,"isActive":true,"pinId":0},{"id":4,"name":"Return","type":{"val":0,"name":"standard","desc":"Standard"},"isDiverted":false,"equipmentType":"valve","circuit":{"id":6,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":2,"name":"pool","desc":"Pool","hasHeatSource":true,"body":1},"showInFeatures":true,"isOn":true,"name":"Pool","nameId":61,"endTime":"2023-02-12T20:01:59.000+0000","startTime":"2023-02-12T14:00:00.053+0000","equipmentType":"circuit"},"isIntake":false,"isReturn":true,"isActive":true,"pinId":0}],"heaters":[{"id":1,"startupDelay":false,"shutdownDelay":false,"type":{"val":1,"name":"gas","desc":"Gas Heater","hasAddress":false},"name":"Gas Heater","endTime":"2023-01-18T19:59:30.895+0000","isOn":false,"bodyId":0,"equipmentType":"heater"}],"chlorinators":[{"id":1,"disabled":false,"isActive":true,"spaSetpoint":10,"poolSetpoint":12,"body":{"val":32,"name":"poolspa","desc":"Pool/Spa"},"status":{"val":0,"name":"ok","desc":"Ok"},"superChlor":false,"superChlorRemaining":0,"targetOutput":12,"type":{"val":0,"name":"pentair","desc":"Pentair"},"model":{"val":2,"name":"intellichlor--20","desc":"IntelliChlor IC20","capacity":20000,"chlorinePerDay":0.7,"chlorinePerSec":0.000008101851851851852},"name":"Intellichlor--20","lastComm":1676219581788,"saltLevel":2950,"saltRequired":0,"currentOutput":12,"superChlorHours":8,"equipmentType":"chlorinator","saltTarget":3400}],"circuits":[{"id":1,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":1,"name":"spa","desc":"Spa","hasHeatSource":true,"body":2},"showInFeatures":true,"isOn":false,"nameId":255,"equipmentType":"circuit"},{"id":2,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":16,"name":"intellibrite","desc":"Intellibrite","isLight":true,"theme":"intellibrite"},"showInFeatures":true,"isOn":false,"name":"Lights","nameId":47,"equipmentType":"circuit"},{"id":3,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":0,"name":"generic","desc":"Generic"},"showInFeatures":true,"isOn":false,"name":"Cleaner","nameId":22,"equipmentType":"circuit"},{"id":4,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":5,"name":"mastercleaner","desc":"Master Cleaner","body":1},"showInFeatures":true,"isOn":true,"name":"Chemical Feeder","nameId":20,"endTime":"2023-02-12T21:41:09.000+0000","startTime":"2023-02-12T15:39:09.562+0000","equipmentType":"circuit"},{"id":5,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":0,"name":"generic","desc":"Generic"},"showInFeatures":true,"isOn":false,"name":"AUX 4","nameId":6,"equipmentType":"circuit"},{"id":6,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":2,"name":"pool","desc":"Pool","hasHeatSource":true,"body":1},"showInFeatures":true,"isOn":true,"name":"Pool","nameId":61,"endTime":"2023-02-12T20:01:59.000+0000","startTime":"2023-02-12T14:00:00.053+0000","equipmentType":"circuit"}],"features":[{"id":11,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Drain Line","type":{"val":13,"name":"generic","desc":"Generic"},"nameId":25,"equipmentType":"feature"},{"id":12,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Feature 2","type":{"val":0,"name":"generic","desc":"Generic"},"nameId":95,"equipmentType":"feature"},{"id":13,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Feature 3","type":{"val":0,"name":"generic","desc":"Generic"},"nameId":96,"equipmentType":"feature"},{"id":14,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Feature 4","type":{"val":0,"name":"generic","desc":"Generic"},"nameId":97,"equipmentType":"feature"},{"id":15,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Pool High","type":{"val":13,"name":"generic","desc":"Generic"},"nameId":62,"equipmentType":"feature"},{"id":16,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Feature 6","type":{"val":0,"name":"generic","desc":"Generic"},"nameId":99,"equipmentType":"feature"},{"id":17,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Feature 7","type":{"val":0,"name":"generic","desc":"Generic"},"nameId":100,"equipmentType":"feature"},{"id":18,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"Feature 8","type":{"val":0,"name":"generic","desc":"Generic"},"nameId":101,"equipmentType":"feature"},{"id":20,"freezeProtect":false,"showInFeatures":true,"isOn":false,"name":"AUX EXTRA","type":{"val":0,"name":"generic","desc":"Generic"},"nameId":93,"equipmentType":"feature"}],"circuitGroups":[],"lightGroups":[{"id":192,"action":{"val":0,"name":"ready","desc":"Ready"},"isActive":true,"isOn":false,"name":"Intellibrite","type":{"val":3,"name":"intellibrite","desc":"IntelliBrite"},"equipmentType":"lightGroup","circuits":[{"id":1,"circuit":{"id":2,"freezeProtect":false,"action":{"val":0,"name":"ready","desc":"Ready"},"type":{"val":16,"name":"intellibrite","desc":"Intellibrite","isLight":true,"theme":"intellibrite"},"showInFeatures":true,"isOn":false,"name":"Lights","nameId":47,"equipmentType":"circuit"},"position":0,"color":0,"swimDelay":1,"master":0,"isActive":false}],"lightingTheme":{"val":196,"name":"white","desc":"White","types":["intellibrite"],"sequence":11}}],"virtualCircuits":[{"id":132,"isActive":true,"isOn":false,"type":{"val":132,"name":"freeze","desc":"Freeze","assignableToPumpCircuit":true},"name":"Freeze","equipmentType":"virtualCircuit"},{"id":130,"isActive":true,"isOn":false,"type":{"val":130,"name":"poolHeater","desc":"Pool Heater","assignableToPumpCircuit":true},"name":"Pool Heater","equipmentType":"virtualCircuit"},{"id":131,"isActive":true,"isOn":false,"type":{"val":131,"name":"spaHeater","desc":"Spa Heater","assignableToPumpCircuit":true},"name":"Spa Heater","equipmentType":"virtualCircuit"}],"covers":[],"filters":[{"id":1,"name":"Filter","body":{"val":32,"name":"poolspa","desc":"Pool/Spa"},"filterType":{"val":3,"name":"unknown","desc":"Unknown"},"isOn":true,"equipmentType":"filter"}],"schedules":[],"chemControllers":[],"chemDosers":[],"delays":[]}

Crewski commented 1 year ago

Thanks for all the information. Looks like the main issue is that you don't have a temp for your spa. I'm guessing that you've restarted nodejs-pc and haven't switched over to spa mode since the restart. Does a spa temp show in dashPanel?

FlaMike commented 1 year ago

Actually, we don't have a spa--just a pool.

FlaMike commented 1 year ago

BTW, I truly appreciate all of the effort you & rstrouse put forth on these projects. I don't know how many folks have their pools up & running I February (I know you don't) so I thought I'd check out the updates. I loaded it initially the day it came out. I thought either I messed up on the upgrade or someone would report issues so I waited a few days before posting.

In any event, since I can easily go back to 0.4.1 to keep my pool running, I'm more than happy to help out in any way I can.

Thanks again for your time, patience, & quick responses!

Mike

Crewski commented 1 year ago

Guess that explains why you don't have a temp!

We need a way to determine what is actually equipment and what is just something in the config. @rstrouse , any ideas on that?

For now you can do a "temp check" In your custom_component/njspc-ha folder, in sensor.py replace (starting at line 74):

        if (
            "bodies" in config["temps"]
        ):  # We can have Nobody Nixie systems (equipment only)
            for body in list(config["temps"]["bodies"]):
                new_devices.append(
                    BodyTempSensor(coordinator=coordinator, units=units, body=body)
                )

with:

        if (
            "bodies" in config["temps"]
        ):  # We can have Nobody Nixie systems (equipment only)
            for body in list(config["temps"]["bodies"]):
                if "temp" in body:
                    new_devices.append(
                        BodyTempSensor(coordinator=coordinator, units=units, body=body)
                    )

That'll take care of the first error hopefully and let things load. Let me know how it works......or doesn't.

FlaMike commented 1 year ago

I made the code change you suggested and restarted & reloaded the integration. Things are definitely an improvement--up to 75 entities now. Still missing the acid feeder, the cleaner (Polaris), and an auxiliary circuit to control a drain valve.

I'm going to downgrade again to keep things running, but I can play more later today or during the week.

FlaMike commented 1 year ago

BTW, I don't have a (cartridge?) filter with the various sensors that showed up in my system--just a plain old sand filter. Some of the other entities that were "discovered" are not present in my pool, per your note to @rstrouse

Crewski commented 1 year ago

I quickly looked at this, seems like your phantom spa is causing issues again. There is no name for the "spa" circuit, and unfortunately it's the first one in the list so the ones behind if fail.

I pushed out v0.4.3-beta as a beta release. Try that out and see if you get all the entities you need (plus the ones you don't).

FlaMike commented 1 year ago

I just pulled the beta release & found all of the "missing" entities/devices. I added them back to my UI and all looks good again. Still have lots of surplus stuff (some from release 0.4) and some from devices I don't have, but I'm running 100% again. Just need to update the scheduler card & I'll be fully back in business.

Thanks so much for getting this done so quickly!

rstrouse commented 1 year ago

@Crewski njsPC will only add items to the config that should be there and will remove those that should not. In the case of the spa his panel is being identified as a shared pool/spa. I have seen this a couple of times where the PB ordered the wrong panel for the construction. Theoretically it works but there are options for the non-existent spa reported on the panel. In most instances these can be ignored.

The unfortunate part of this is that the Pentair panels do not report in the order that we would hope. The only time it reports a spa temp is when the spa has been turned on. I have been working on another pull request for you that checks the keys for the sensor value and sets it to none when the value is not yet there. If this truly is an ET2 4 and not an ET2 4P then the body sensors for a spa should exist. If they don't then the parity between what the panel is reporting and the configuration will be out of sync.

@FlaMike I took a quick look at your emit from njsPC. It thinks you have an EasyTouch 2 4. Not an EasyTouch 2 4P. The difference between these is that the EasyTouch 2 4 is a pool/spa system not a single body. You cannot remove that from the circuit list no matter what in that case and Pentair will report information that is very specific to this configuration.

However, since neither I nor @tagyoureit have an ET4 panel it is possible that we don't have the correct id bytes for the part number. If I can get you to find the part number on the EasyTouch personality card we will for sure know whether the PB installed a shared pool/spa system on a single body construction.

A while back we added a feature that hides the body in dashPanel if the body should not exist. We did this specifically because we had seen a number of folks that had the wrong panel for their construction and it simply creates confusion. Bear in mind these are two very different setups.

What I think shocks folks is that with the correct panel on a single body construction there are other options that only exist with a single body panel to allow for HIGH/LOW temp management of the single body. Don't feel like you are missing much though it simply replaces the spa with a HIGH temp option and omits the valve rotation delays and spillway modes.

The reason why you are seeing a cartridge filter is that you have not gone into dashPanel to identify that your pool filter is a Sand filter. If you add a pressure sensor to it, then it will tell you when the filter needs cleaned and keep track of the changes over time so you can get a pretty good idea of where your clean filter started and where it is now. You will find this under the gears menu in dashPanel/bodies. If you have no desire to monitor this then that can be ignored.

FlaMike commented 1 year ago

Looking at the PC Dashboard, it shows the controller is an Easy Touch 2 4 with a part number of ET2-4. Is that what you're looking for or is there something on the physical controller I should look at for the part number?

If I recall accurately, I think the PB may have installed a shared pool/spa system. I asked why there were spa options when we don't have one & he replied there was not a way to get rid of them. (I had the conversation a few years ago and may not recall accurately, however).

I changed my filter setting to a sand filter. Thanks!

rstrouse commented 1 year ago

Yeah there will be a sticker on the board at the pad. It will likely start with 52xxxxxxx. This indicates which resistors are installed on the board and it dictates how the bodies are managed.

Yes there is no way to remove them if you install the wrong panel for the specific installation. If you have pool/spa options in your ET remote then you most definitely do not have a P model.

Crewski commented 1 year ago

I just pushed out a new beta with the changes @rstrouse provided. They should address most of your issues (minus the whole wrong controller thing).

FlaMike commented 1 year ago

Thanks for pushing out another beta so quickly!

I installed the updated best version, restarted HA, & reloaded the integration. I now have even more sensors. The only issue I am having now is a new one... I don't seem to be able to turn the pool lights on & off from HA. There are devices for both Intellibright and Lights in HA, but the on/off toggle for each just switches on & then back to off a few seconds later.

I can turn either on/off from the port 5150 dashboard. Picture attached. Any suggestions are welcome.

image

Crewski commented 1 year ago

Looks like we were accidentally overwriting some variables after setting them. Just pushed out beta3 to try. No need to reload the integration, just restart HA after installing.

FlaMike commented 1 year ago

Looks like this morning's update did the trick--pool lights are working again! Have not done "extensive" testing, but first impression is all is good. I'll let you know if any anomalies appear.

I'm happy to continue as your tester, when you need me to do so.

Thanks again!