claudegel / sinope-130

Neviweb130 custom component for Home Assistant to manage devices connected via a GT130 and wifi devices from Sinopé
GNU General Public License v3.0
78 stars 15 forks source link

Failed to call service scene/turn_on. two or more values in the same group of exclusion 'brightness' @ data[<brightness>] #119

Open SylvainGa opened 1 year ago

SylvainGa commented 1 year ago

Running HASSIO 2022.12.0 with v1.8.0 of the Sinope Integration. When I add a DM2550ZB in a scene, I get that popup on the lower left and the scene doesn't work

Failed to call service scene/turn_on. two or more values in the same group of exclusion 'brightness' @ data[]

From what I gather on a search for that problem, you can't set rbg_color and color_temp at the same time anymore. Don't know if that's the issue.

When I replace the DM2550ZB dimmer for a Philips you light, it works correctly so I don't think it's the scene,

claudegel commented 1 year ago

DM2550ZB don't have property for rgb_color and color_temp ?

SylvainGa commented 1 year ago

I don't think so, it's just a dimmer so only the intensity of the lights connected to it can be set. See this video showing the problem

https://youtu.be/HSa9kpW3qzc

It only does that with the DM2550ZB entities. My Tasmota dimmers are working fine.

claudegel commented 1 year ago

Your scene is just trying to turn_on the DM2550ZB ? Can you send me that scene so I can test it and better understand

SylvainGa commented 1 year ago

Yes, just that light for now since I can't make it work. Here's the scene:

- id: '1608353075399'
  name: Salle à manger - Plafonnier à 100%
  entities:
    light.neviweb130_light_light_spot_salle_a_diner:
      supported_color_modes:
      - brightness
      brightness_pct: 99
      minimum_intensity: 600
      phase_control: forward
      Double_up_Action: 'on'
      onOff: 'on'
      keypad: unlocked
      timer: 0
      led_on: 50,165,0,10
      led_off: 50,220,255,10
      hourly_kwh_count: 0.168
      daily_kwh_count: 0.168
      monthly_kwh_count: 0
      hourly_kwh: 0
      daily_kwh: 0
      monthly_kwh: 0.168
      sku: DM2550ZB
      id: 345254
      device_class: light
      friendly_name: Salle à manger - Encastré
      supported_features: 1
      color_mode: brightness
      brightness: 252
      state: 'on'
  metadata:
    light.neviweb130_light_light_spot_salle_a_diner:
      entity_only: true

Thanks for taking the time to look into it,

SylvainGa commented 1 year ago

If that can help, I just noticed that when I turn the light off or on from the switch, its new state is not reflected in Home Assistant. Turning it on or off from Home Assistant works and its new state is reflected. Looking at the switch status from the Developer tools pane, I see zero attribute change when using the switch to run turn on/off the light.

Light was turned off from HA Off from HA

Light was then turned on from HA On from HA

Light was turned off from the switch (no change in any attributes) Off from Switch

Light was turned on from the switch (attributes remained as before) On from Switch

claudegel commented 1 year ago

That's normal behavior. When you change device state via HA service, immediately after, HA poll and refresh the device state. So you open the light and HA immediately check back the light state. When you open the light directly on the switch. Then the device send a changed state info to the GT130 and Neviweb know that you have open the light. But the way neviweb130 work is not a direct connection to the gt130. We need to poll Neviweb every 5-6 minutes (scan_intervall) to find out if something have changed outside of HA. If you wait longer the the scan_intervall you will see that HA have noticed the new light state and set it accordingly. If you want direct feedback then you can use ZHA where each device report state changes directly to ZHA and HA.

SylvainGa commented 1 year ago

Hmm, if I understand this correctly, I need to disconnect them from my GT130 hub to connect them to ZHA. Is that right?

claudegel commented 1 year ago

Yes, when your on ZHA your connected devices send there state change directly to HA and you know it immediately. Whit the GT130, you need to poll Neviweb every scan_interval to find out if there is something that have changed since last visit.

SylvainGa commented 1 year ago

Ok, so I understand that talking directly to the GT130 gateway is still not possible then, right?

Were you able to see why the scenes don't work with the DM2550ZB? Are there logs I can turn on to help you diagnose the issue?

claudegel commented 1 year ago

We can talk directly with the GT125. I've done an app for that. But Sinopé never release there app data for the GT130 For your scene I didn't have time this week but next week I should have more free time

To check in the log add the following to configuration.yaml

logger:
  default: warning
  logs:
    homeassistant.custom_components: debug
    custom_components.neviweb130: debug
    homeassistant.service: debug
SylvainGa commented 1 year ago

Hi, this is what I see with those log debug commands

I enter the scene with the lone DM2550ZB in. The light is currently Off since anytime I try to save it with the light On, it fails. So, with the light Off, this is what is displayed as I enter the that Scene:

2022-12-15 21:23:13.052 WARNING (MainThread) [homeassistant.components.light.reproduce_state] The use of other attributes than device state attributes is deprecated and will be removed in a future release. Invalid attributes are ['brightness_pct']. Read the logs for further details: https://www.home-assistant.io/integrations/scene/

Opening up the lights setting doesn't create any line in the log. The light is Off. Turning the light On produces these lines in the log:

2022-12-15 21:26:41.235 DEBUG (SyncWorker_4) [custom_components.neviweb130] Data = {'onOff': 'on'}
2022-12-15 21:26:41.235 DEBUG (SyncWorker_4) [custom_components.neviweb130] Request response = 200
2022-12-15 21:26:41.235 DEBUG (SyncWorker_4) [custom_components.neviweb130] Json Data received= {'onOff': 'on'}
2022-12-15 21:26:41.236 DEBUG (SyncWorker_4) [custom_components.neviweb130] Content = b'{"onOff":"on"}'
2022-12-15 21:26:41.238 DEBUG (SyncWorker_4) [custom_components.neviweb130] Text = {"onOff":"on"}
2022-12-15 21:26:42.026 DEBUG (SyncWorker_8) [custom_components.neviweb130.light] Updating neviweb130 light light Spot, Salle à diner (0.785 sec): {'intensity': 9.84251968503937, 'intensityMin': 600, 'onOff': 'on', 'lockKeypad': 'unlocked', 'powerTimer': 0, 'statusLedOnIntensity': 50, 'statusLedOffIntensity': 50, 'statusLedOnColor': {'red': 165, 'green': 0, 'blue': 10}, 'statusLedOffColor': {'red': 220, 'green': 255, 'blue': 10}, 'phaseControl': 'forward', 'configKeyDoubleUp': 'on'}

So far, no error popup on screen. Closing the light popup doesn't produce any error and nothing is shown in the log. I also don't have the Save button as if I didn't make any change, although I changed the light status from Off to On.

Closing the Screne creates these log entry (and the light turn Off as it was Off to start with)

2022-12-15 21:29:39.899 WARNING (MainThread) [homeassistant.components.light.reproduce_state] The use of other attributes than device state attributes is deprecated and will be removed in a future release. Invalid attributes are ['brightness_pct']. Read the logs for further details: https://www.home-assistant.io/integrations/scene/
2022-12-15 21:29:40.244 DEBUG (SyncWorker_0) [custom_components.neviweb130] Data = {'onOff': 'off'}
2022-12-15 21:29:40.244 DEBUG (SyncWorker_0) [custom_components.neviweb130] Request response = 200
2022-12-15 21:29:40.244 DEBUG (SyncWorker_0) [custom_components.neviweb130] Json Data received= {'onOff': 'off'}
2022-12-15 21:29:40.244 DEBUG (SyncWorker_0) [custom_components.neviweb130] Content = b'{"onOff":"off"}'
2022-12-15 21:29:40.244 DEBUG (SyncWorker_0) [custom_components.neviweb130] Text = {"onOff":"off"}
2022-12-15 21:29:40.974 DEBUG (SyncWorker_0) [custom_components.neviweb130.light] Updating neviweb130 light light Spot, Salle à diner (0.727 sec): {'intensity': 9.84251968503937, 'intensityMin': 600, 'onOff': 'off', 'lockKeypad': 'unlocked', 'powerTimer': 0, 'statusLedOnIntensity': 50, 'statusLedOffIntensity': 50, 'statusLedOnColor': {'red': 165, 'green': 0, 'blue': 10}, 'statusLedOffColor': {'red': 220, 'green': 255, 'blue': 10}, 'phaseControl': 'forward', 'configKeyDoubleUp': 'on'}

Activating the Scene returns the error I posted in my initial post and the following in the log:

2022-12-15 21:32:05.405 WARNING (MainThread) [homeassistant.components.light.reproduce_state] The use of other attributes than device state attributes is deprecated and will be removed in a future release. Invalid attributes are ['brightness_pct']. Read the logs for further details: https://www.home-assistant.io/integrations/scene/

Hope that helps.

claudegel commented 1 year ago

I'll check that deprecated part in HA. It's possible that we use brightness_pct for dimmer and the other device use only on/off or brightness

claudegel commented 1 year ago

Could you remove the brightness_pct from your scene ? in neviweb130 light the brightness is automatically converted to brightness_pct which is the data sent to Neviweb. So you don't need to address specifically this parameter. Your scene should use only brightness.

SylvainGa commented 1 year ago

I don't think that's something I have control when adjusting the scene through the GUI, but by editing the scenes.yaml file manually and removing the brightness_pct: 50 from it, it worked. This is what that scene looked like before I took it off

- id: '1604885016420'
  name: Salle à manger - Manger
  entities:
    light.neviweb130_light_light_spot_salle_a_diner:
      supported_color_modes:
      - brightness
      brightness_pct: 50
      minimum_intensity: 600
      Temperature_status:
      phase_control: forward
      Double_up_Action: 'on'
      onOff: 'on'
      keypad: unlocked
      timer: 0
      led_on: 50,165,0,10
      led_off: 50,220,255,10
      hourly_kwh_count: 0.188
      daily_kwh_count: 0.188
      monthly_kwh_count: 0
      hourly_kwh: 0
      daily_kwh: 0
      monthly_kwh: 0.188
      sku: DM2550ZB
      id: 345254
      device_class: light
      friendly_name: Salle à manger - Encastré
      supported_features: 1
      color_mode: brightness
      brightness: 128
      state: 'on'

I can deal with editing the file manually. Is it a bug within Home Assistant itself or the Neviweb integration?

Thanks,

Edit: Editing all the occurrences of the DM2550ZB lights in the screnes.yaml file. I noticed that brightness_pct is present whether the light is on or off while brightness is only present when the light is on. The value for brightness when the light is off is ignored and the light turns off.

SylvainGa commented 1 year ago

Yes, when your on ZHA your connected devices send there state change directly to HA and you know it immediately. Whit the GT130, you need to poll Neviweb every scan_interval to find out if there is something that have changed since last visit.

Hi Claude, I got a ComBee II and was wondering, once the dimmers and thermostats are connected to it, I'll lose the ability to update their firmware, right?

claudegel commented 1 year ago

Yes the firmware can be updated only when connected to the GT130. Every few days Neviweb scan for firmware version and send update to the devices that are not up to date. But those update are not too frequent. It is mostly when you buy a new device. It is possible that it is not at the latest firmware and once connected Neviweb will fix that.

SylvainGa commented 1 year ago

Hi, just to let you know that any time I try to adjust a scene through the GUI with DM2550ZB dimmers in it, the brightness/brightness_pct conflict reappears for those DM2550ZB. My only option right now is to manually edit the scenes.yaml file and reload the scenes.

claudegel commented 1 year ago

I'll check if I can remove the brightness_pct attribute. If there are no conflict I'll remove it completely.

SylvainGa commented 1 year ago

Thanks

SylvainGa commented 1 year ago

Hi, were you able to look into it? Thanks

claudegel commented 1 year ago

Hi, what I can see is that I will have to remove completely the brightness_pct from light.py and do a translation when sending a brightness change to neviweb. I'll create a new branch to test as soon as I finish with another bug I have with my VPN hat is not working properly when I'm away.

SylvainGa commented 1 year ago

Thanks

claudegel commented 10 months ago

I've found a bug in the turn.on service for light for neviweb130. We need to send the onOff value and the brightness value at the same time or the service won't work. I've done the correction in the next release. it will probably help for your scene