joBr99 / nspanel-lovelace-ui

Custom Firmware for NsPanel with the design of HomeAssistant's lovelace UI in mind, works with Tasmota.
GNU General Public License v3.0
857 stars 187 forks source link

[BUG] Multiple panels entity card bug #1106

Closed sjampeter closed 6 months ago

sjampeter commented 6 months ago

PROBLEM DESCRIPTION

I would like to use multiple panels with some of the same light-entities and some different light entities. when putting the same light- entitie in both configurations, the panels get locked.

REQUESTED INFORMATION

nspanel-2: module: nspanel-lovelace-ui class: NsPanelLovelaceUIManager config: panelRecvTopic: "tele/NSPanel_keuken/RESULT" panelSendTopic: "cmnd/NSPanel_keuken/CustomSend" model: eu sleepTimeout: 0 sleepBrightness:

- [x] Go to Settings>Add-ons>AppDaemon>Log (or the output of your TS script) and then, provide the output of the log during your issue/bug occurs:

Log output here: `2023-12-27 13:53:01.849455 WARNING nspanel-2: ------------------------------------------------------------ 2023-12-27 13:53:07.087472 INFO nspanel-2: MQTT callback for: {'topic': 'tele/NSPanel_keuken/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,sleepReached,cardEntities"}'} 2023-12-27 13:53:07.090487 INFO nspanel-2: Received Message from Screen: event,sleepReached,cardEntities 2023-12-27 13:53:07.094621 INFO nspanel-2: Button Press Event; entity_id: cardEntities; button_type: sleepReached; value: None 2023-12-27 13:53:07.097699 INFO nspanel-2: Sending MQTT Message: pageType~screensaver 2023-12-27 13:53:07.102798 INFO nspanel-1: Sending MQTT Message: timeout~15 2023-12-27 13:53:07.114708 INFO nspanel-2: Sending MQTT Message: timeout~5 2023-12-27 13:53:07.241869 INFO nspanel-1: Sending MQTT Message: weatherUpdate~���~38066~INIEUW133~9.8��C~���~12703~do~11.0��C~���~12703~vr~12.0��C~���~12703~za~11.0��C~���~12703~zo~10.0��C~���~17299~temperatuur woonkamer SI7021.2~19.20 ��C 2023-12-27 13:53:07.254559 INFO nspanel-1: Sending MQTT Message: statusUpdate~~ 2023-12-27 13:53:07.277600 INFO nspanel-2: Sending MQTT Message: weatherUpdate~���~38066~INIEUW133~9.8��C~���~12703~do~11.0��C~���~12703~vr~12.0��C~���~12703~za~11.0��C~���~12703~zo~10.0��C~���~17299~temperatuur woonkamer SI7021.2~19.20 ��C 2023-12-27 13:53:07.292981 INFO nspanel-2: Sending MQTT Message: statusUpdate~~ 2023-12-27 13:53:07.321214 INFO nspanel-2: Sending MQTT Message: timeout~5 2023-12-27 13:53:07.383481 INFO nspanel-2: Sending MQTT Message: weatherUpdate~���~38066~INIEUW133~9.8��C~���~12703~do~11.0��C~���~12703~vr~12.0��C~���~12703~za~11.0��C~���~12703~zo~10.0��C~���~17299~temperatuur woonkamer SI7021.2~19.20 ��C 2023-12-27 13:53:07.388696 INFO nspanel-2: Sending MQTT Message: statusUpdate~~ 2023-12-27 13:54:00.119186 INFO nspanel-1: Sending MQTT Message: time~13:54~ 2023-12-27 13:54:00.135703 INFO nspanel-2: Sending MQTT Message: time~13:54~ 2023-12-27 13:54:07.376535 INFO nspanel-2: Sending MQTT Message: timeout~5 2023-12-27 13:54:07.380550 INFO nspanel-1: Sending MQTT Message: timeout~15 2023-12-27 13:54:07.482789 INFO nspanel-1: Sending MQTT Message: weatherUpdate~���~38066~INIEUW133~9.8��C~���~12703~do~11.0��C~���~12703~vr~12.0��C~���~12703~za~11.0��C~���~12703~zo~10.0��C~���~17299~temperatuur woonkamer SI7021.2~19.23 ��C 2023-12-27 13:54:07.492976 INFO nspanel-1: Sending MQTT Message: statusUpdate~~ 2023-12-27 13:54:07.505839 INFO nspanel-2: Sending MQTT Message: weatherUpdate~���~38066~INIEUW133~9.8��C~���~12703~do~11.0��C~���~12703~vr~12.0��C~���~12703~za~11.0��C~���~12703~zo~10.0��C~���~17299~temperatuur woonkamer SI7021.2~19.23 ��C 2023-12-27 13:54:07.512247 INFO nspanel-2: Sending MQTT Message: statusUpdate~~ 2023-12-27 13:54:49.166845 INFO nspanel-2: MQTT callback for: {'topic': 'tele/NSPanel_keuken/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,screensaver,bExit,1"}'} 2023-12-27 13:54:49.170231 INFO nspanel-2: Received Message from Screen: event,buttonPress2,screensaver,bExit,1 2023-12-27 13:54:49.176410 INFO nspanel-2: Button Press Event; entity_id: screensaver; button_type: bExit; value: 1 2023-12-27 13:54:49.218446 INFO nspanel-2: Sending MQTT Message: pageType~cardEntities 2023-12-27 13:54:49.226476 INFO nspanel-2: Sending MQTT Message: timeout~5 2023-12-27 13:54:49.241676 WARNING nspanel-2: ------------------------------------------------------------ 2023-12-27 13:54:49.242161 WARNING nspanel-2: Unexpected error in worker for App nspanel-2: 2023-12-27 13:54:49.243303 WARNING nspanel-2: Worker Ags: {'id': '1f4ebabd54a54f7caffe0c21f3a2bedd', 'name': 'nspanel-2', 'objectid': 'cdbf74debbc54e95b171d0fbcc044d27', 'type': 'event', 'event': 'MQTT_MESSAGE', 'function': <bound method LuiMqttListener.mqtt_event_callback of <luibackend.mqtt.LuiMqttListener object at 0x7f2223a8fa10>>, 'data': {'topic': 'tele/NSPanel_keuken/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,screensaver,bExit,1"}'}, 'pin_app': True, 'pin_thread': 1, 'kwargs': {'topic': 'tele/NSPanel_keuken/RESULT', '__thread_id': 'thread-1'}} 2023-12-27 13:54:49.243548 WARNING nspanel-2: ------------------------------------------------------------ 2023-12-27 13:54:49.247579 WARNING nspanel-2: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1095, in worker funcref(args["event"], data, self.AD.events.sanitize_event_kwargs(app, args["kwargs"])) File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/mqtt.py", line 57, in mqtt_event_callback self._controller.button_press(entity_id, btype, value) File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/controller.py", line 234, in button_press self._pages_gen.render_card(self._current_card) File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/pages.py", line 739, in render_card self.generate_entities_page(navigation, card.title, card.entities, card.cardType, temp_unit) File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/pages.py", line 428, in generate_entities_page command += self.generate_entities_item(item, cardType, tempUnit) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/pages.py", line 253, in generate_entities_item color = self.get_entity_color(entity, ha_type=entityType, overwrite=colorOverride) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/pages.py", line 102, in get_entity_color color = rgb_brightness(color, attr.brightness) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/helper.py", line 34, in rgb_brightness brightness = int(scale(brightness,(0,255),(70,255))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/nspanel-lovelace-ui/luibackend/helper.py", line 9, in scale return ((val - src[0]) / (src[1]-src[0])) * (dst[1]-dst[0]) + dst[0]


TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'`

```

### TO REPRODUCE

install 2 panels with the same entitie

### EXPECTED BEHAVIOUR

when i ajust the light intensity of - entity: light.woonkamer_spotjes_bank on 1 panel, the oder panel have to be show the same ajustment. with the other panel i should be able to ajust the same entitie. over and over again

### SCREENSHOTS
_If applicable, add screenshots/pictures to help explain your problem._

### ADDITIONAL CONTEXT
_Add any other context about the problem here._
_Please note here in case you are using ioBroker_

### PANEL / FIRMWARE VERION

EU 
joBr99 commented 6 months ago

Please post the appdaemon log while this issue happens

sjampeter commented 6 months ago

i posted the requested logs.

joBr99 commented 6 months ago

It looks like the brightness value is None can you see this in the developer tools on homeassistant too?

sjampeter commented 6 months ago

hmm. i dont think that this is the issue here. the light works perfect white one nspanel. the problem occurs when i want to put the same entitie on the second panel.

image

joBr99 commented 6 months ago

Each panel has a separate appdaemon instance, they are isolated from each other.

It probably doesn't make a lot of sense to dig deeper into this, as the next release will be no longer based on appdaemon.

Would you try the new backend? #1058

Note that the list style sleepBrightness is currently not implemented - you can use an input_number instead with an automation.

sjampeter commented 6 months ago

hmm. i will look into it. will take a bit of time to try this. i will inform you with my findings. thanks...

sjampeter commented 6 months ago

the new backend seems to work fine. issue resolved. thanks for the fast response.