rstrouse / nodejs-poolController-dashPanel

A dashboard panel for tagyoureit/nodejs-poolController
33 stars 20 forks source link

Changes to light theme endpoint #45

Open putnam opened 2 years ago

putnam commented 2 years ago

Currently, dashPanel is using an old API endpoint to retrieve light themes for a circuit.

For example

GET /config/circuit/192/lightThemes {}

This endpoint is now blank for me -- I don't see it mentioned in the current documentation either. It looks like the API has moved or simplified storage of the light group themes to the /config/options/lightGroups endpoint.

As a result, this is what Light Group Settings looks like for me: image

Additionally I can't seem to apply any color changes to the pool and I'm a little confused what "Set" "Swim" and "Sync" mean

rstrouse commented 2 years ago

Are you running Nixie, IntelliTouch, EasyTouch, or IntelliCenter? This is the correct endpoint but perhaps here is something with one of those board definition. In some board configurations the theme list is different and multiple vendor standards are supported (IntelliBrite, ColorLogic, and MagicStream). If you are running IntelliTouch or EasyTouch and do not have any IntelliBrite lights, this light group should not appear. If you are running Nixie and you do not have any color changing lights in the group then it should not be showing the palette or theme bar.

putnam commented 2 years ago

I'm running IntelliTouch (i9+3). I do have IntelliBrite lights (one in the pool and one in the hot tub) and they do the color-changing thing. On the wireless remote I see the various lighting "party" effects where the lights change around. I do mainly just leave it on solid blue everywhere since it's a blue tiled pool and it looks best that way, but just noticed this playing around.

Looking at the docs here: https://tagyoureit.github.io/nodejs-poolcontroller-api/

The token "lightThemes" doesn't appear anywhere, and I saw this on another entry:

/config/lightGroups/themes/ 
Get a list of light group themes 
This endpoint is going away. Use themes object in /config/options/lightGroups instea

Is the lightThemes endpoint not documented maybe? I see the available themes in the /config/options/lightGroups response. But the circuit-specific themes endpoint in use here is just returning blank. It makes sense to me that the list of available themes would live somewhere global and not on a specific circuit, probably, but I don't know enough about this API to say for sure.

rstrouse commented 2 years ago

On the Pentair panels there are only one set of themes and either endpoint should return the same set of themes. I will take a look at the endpoint implementation for IntelliTouch to see where it is not returning them.

Btw the Set Sync and Swim are the SAm implementation for IntelliBrite.

tagyoureit commented 2 years ago

Checkout https://github.com/tagyoureit/nodejs-poolController/issues/360. Maybe relevant. I’ll be back in town later this week.

rstrouse commented 2 years ago

Thanks @tagyoureit that flashes the memory a bit. The reason this would be true is that the IntelliBrite circuits are not assigned to the light group. I don't know if we disabled the ability to edit the IntelliBrite group in dashPanel for Touch or not. In that case one could remove the lights from the group and then there would not be any available themes.

@putnam please upload a backup so I can see which circuits are assigned to the Intellibrite group. To do this click on the hamburger menu then navigate to the Backups tab and press the backup button. Give it a name and select the njsPC server and press the create backup button.

This will download a zip file to your browser. Upload that file here. I am thinking we need a bit more processing or the Touch controllers.

putnam commented 2 years ago

Here you go.

This also revealed a new bug, which is that backups fail to generate properly if you have the internal njsPC proxy enabled (i.e., proxying to 127.0.0.1). It looks as though the proxy stuff was not added to the *FileApiService calls in widgets.js (line 465).

backup.zip

rstrouse commented 2 years ago

I fixed the fileApiService and the IntelliBrite/Magicstream theme emits. There are a couple of goofy things about what IntelliTouch reports that will require some work for the Touch OCPs. For instance the Hold, Reset, Mode, and Thumper are not really themes but for some reason they are in the theme list. These are lighting commands that probably should not be in the the theme list.

I don't have an IntelliTouch anymore and this is no longer how the IntelliBrite controller works in IntelliCenter. In IntelliTouch the IntelliBrite controller is global to all IntelliBrite lights. In IntelliCenter themes can be set for each light circuit. Either way you find yourself clicking the button, waiting, then hoping the selection you made stuck. Boooh.

putnam commented 2 years ago

Nice, that change resolved the UI issue and I am able to now click a color or theme and it gets applied. The Colors tab seems still kind of inop, and solid colors are instead listed as "Light Shows", but I am guessing this has to do with the differences between IntelliTouch and IntelliCenter.

Themes/shows showing properly: image

As soon as I click a theme (or solid color), it is "sequenced" and applied immediately. I assume this is the intended behavior. Notably, the currently-active theme is not pre-checked in the list when the widget loads.

This is the Colors tab for me: image

The concept of colors on my jets sounds cool but I don't think I have that feature. I do know that the RGB LED modules in the pool and the hot tub must be independent, because some of the themes mix and match colors; it would be pretty cool if there were a way to set the colors independently. There isn't on the regular wireless controller, but who knows!

(Can you tell I used to QA web apps?)

putnam commented 2 years ago

OK, another thing: as I play with the lights now, I am able to toggle them on and off sometimes, but not always; I can get the lights into a state where they are powered off, but the state/all endpoint reports them as on. I can repeatedly try to power them "off" again, and the endpoint behaves like they were, but then the next state request continues to mark them as "on".

Some logs from around when I was doing this. The IRL state is the lights are off; the state returned by the API is that they're on; and the request is trying to power them off as I click the button in the UI.

[12/19/2021, 10:02:33 PM] info: [10:02:33 PM] 127.0.0.1 PUT /state/circuit/setState {"id":192,"state":false}
[12/19/2021, 10:02:37 PM] info: [10:02:37 PM] 127.0.0.1 GET /config/lightGroup/192 {}
[12/19/2021, 10:02:37 PM] info: [10:02:37 PM] 127.0.0.1 GET /config/circuit/192/lightThemes {}
[12/19/2021, 10:02:49 PM] info: [10:02:49 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:02:50 PM] info: [10:02:50 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:02:51 PM] info: [10:02:51 PM] 127.0.0.1 PUT /state/circuit/setState {"id":192,"state":false}
[12/19/2021, 10:03:11 PM] info: [10:03:11 PM] 127.0.0.1 GET /config/lightGroup/192 {}
[12/19/2021, 10:03:11 PM] info: [10:03:11 PM] 127.0.0.1 GET /config/circuit/192/lightThemes {}
[12/19/2021, 10:03:14 PM] info: [10:03:14 PM] 127.0.0.1 PUT /state/circuit/setTheme {"id":192,"theme":193}
[12/19/2021, 10:03:42 PM] info: [10:03:42 PM] 127.0.0.1 GET /config/lightGroup/192 {}
[12/19/2021, 10:03:42 PM] info: [10:03:42 PM] 127.0.0.1 GET /config/circuit/192/lightThemes {}
[12/19/2021, 10:03:46 PM] info: [10:03:46 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:03:46 PM] info: [10:03:46 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:03:49 PM] info: [10:03:49 PM] 127.0.0.1 PUT /state/circuit/setState {"id":192,"state":false}
[12/19/2021, 10:03:59 PM] info: [10:03:59 PM] 127.0.0.1 GET /config/lightGroup/192 {}
[12/19/2021, 10:03:59 PM] info: [10:03:59 PM] 127.0.0.1 GET /config/circuit/192/lightThemes {}
[12/19/2021, 10:04:03 PM] info: [10:04:03 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:04:03 PM] info: [10:04:03 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:04:06 PM] info: [10:04:06 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:04:07 PM] info: [10:04:07 PM] 127.0.0.1 GET /state/all?null {}
RS485 Stats:{ "bytesReceived": 63957 "success": 2754, "failed": 58, "bytesSent": 2181, "collisions": 3, "failureRate": 2.06% }
RS485 Stats:{ "bytesReceived": 65204 "success": 2806, "failed": 59, "bytesSent": 2181, "collisions": 3, "failureRate": 2.06% }
RS485 Stats:{ "bytesReceived": 65802 "success": 2835, "failed": 60, "bytesSent": 2181, "collisions": 3, "failureRate": 2.07% }
RS485 Stats:{ "bytesReceived": 66088 "success": 2845, "failed": 61, "bytesSent": 2181, "collisions": 3, "failureRate": 2.10% }
[12/19/2021, 10:05:53 PM] info: [10:05:53 PM] 127.0.0.1 GET /state/all?null {}
[12/19/2021, 10:05:53 PM] info: [10:05:53 PM] 127.0.0.1 GET /state/all?null {}
RS485 Stats:{ "bytesReceived": 69791 "success": 3007, "failed": 62, "bytesSent": 2181, "collisions": 3, "failureRate": 2.02% }
RS485 Stats:{ "bytesReceived": 70607 "success": 3040, "failed": 63, "bytesSent": 2181, "collisions": 3, "failureRate": 2.03% }
RS485 Stats:{ "bytesReceived": 70740 "success": 3044, "failed": 64, "bytesSent": 2181, "collisions": 3, "failureRate": 2.06% }
RS485 Stats:{ "bytesReceived": 71210 "success": 3065, "failed": 65, "bytesSent": 2181, "collisions": 3, "failureRate": 2.08% }
[12/19/2021, 10:09:26 PM] info: [10:09:26 PM] 127.0.0.1 PUT /state/circuit/setState {"id":192,"state":false}
[12/19/2021, 10:09:45 PM] info: [10:09:45 PM] 127.0.0.1 GET /state/all?null {}
RS485 Stats:{ "bytesReceived": 75021 "success": 3232, "failed": 66, "bytesSent": 2194, "collisions": 3, "failureRate": 2.00% }
RS485 Stats:{ "bytesReceived": 75462 "success": 3250, "failed": 67, "bytesSent": 2194, "collisions": 3, "failureRate": 2.02% }
tagyoureit commented 2 years ago

2A8A8854-396B-4BF9-9093-56CEB6DACC87

In EasyTouch/Intellitouch, the blue/red/solid colors you see are themes. It’s sets all the lights to that color.

the Lights tab is directly related to set/sync/swim (set assigns the colors in the colors tab, sync rotates all lights through each color together, and swim will be the follow-the-leader lights running around your pool).