DrozmotiX / ioBroker.esphome

Control your ESP8266/ESP32 with simple yet powerful configuration files created and managed by ESPHome
MIT License
30 stars 23 forks source link

Values in Light Component can't changed with new native-api #173

Closed patricknitsch closed 11 months ago

patricknitsch commented 11 months ago

After changing to the new native-api, I can't change the values in the light component anymore. I can switch the state but all values will be at 255. They are not writeable. See the picture below.

image

DutchmanNL commented 11 months ago

Can you share your yaml please so I can reproduce it ?

patricknitsch commented 11 months ago

Sure. Thanks for your fast answer.

#---------------------------------CONFIGURATION-------------------------------->

esphome:
  name: ${device_name}
  comment: ${device_description}
  platform: ESP8266
  board: esp8285

# WiFi connection
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  ap:
    ssid: ${ssid}
    password: ${password}
    ap_timeout: 1min
  use_address: ${device_name}
captive_portal:

# Enable logging
logger:

# Enable API
api:
  password: ${api_key}

# Enable over-the-air updates
ota:
  password: ${ota_password}

# Sync time with ESP Home
time:
  - platform: sntp
    id: homeassistant_time
    servers: de.pool.ntp.org
    update_interval: 30s
    on_time_sync:
      then:
        - logger.log:
            format: "Synchronized system clock"
            level: WARN

# Text sensors with general information
text_sensor:
  # Version
  - platform: version
    name: Version

  # Wifi
  - platform: wifi_info
    ip_address:
      name: IP Address

  # Uptime formatted
  - platform: template
    name: Uptime
    update_interval: 30s
    icon: mdi:clock-start
    lambda: |-
      int seconds = (id(Uptime).state);
      int days = seconds / (24 * 3600);
      seconds = seconds % (24 * 3600);
      int hours = seconds / 3600;
      seconds = seconds % 3600;
      int minutes = seconds /  60;
      seconds = seconds % 60;
      if ( days ) {
        return { (String(days) +"d " + String(hours) +"h " + String(minutes) +">
      } else if ( hours ) {
        return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) >
      } else if ( minutes ) {
        return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
      } else {
        return { (String(seconds) +"s").c_str() };
      }

#---------------------------------CONFIGURATION-------------------------------->

#-----------------------------------EXECUTION---------------------------------->

sensor:
  # Uptime sensor
  - platform: uptime
    id: Uptime

  # WiFi Signal sensor
  - platform: wifi_signal
    name: Wifi Signal
    update_interval: 10s

  # Internal Voltage
  - platform: adc
    pin: VCC
    name: Internal Voltage
switch:
  # Switch to restart the plug
  - platform: restart
    name: Restart Switch

# Light
light:
  - platform: monochromatic
    name: ${device_name}_ch1
    id: ${device_name}_ch1
    output: ${device_name}_out_ch1
  - platform: monochromatic
    name: ${device_name}_ch2
    id: ${device_name}_ch2
    output: ${device_name}_out_ch2
  - platform: monochromatic
    name: ${device_name}_ch3
    id: ${device_name}_ch3
    output: ${device_name}_out_ch3
  - platform: monochromatic
    name: ${device_name}_ch4
    id: ${device_name}_ch4
    output: ${device_name}_out_ch4

# Outputs
output:
  - platform: esp8266_pwm
    id: ${device_name}_out_ch1
    pin: GPIO12
    frequency: 1000 Hz
  - platform: esp8266_pwm
    id: ${device_name}_out_ch2
    pin: GPIO15
    frequency: 1000 Hz
  - platform: esp8266_pwm
    id: ${device_name}_out_ch3
    pin: GPIO14
    frequency: 1000 Hz
  - platform: esp8266_pwm
    id: ${device_name}_out_ch4
    pin: GPIO4
    frequency: 1000 Hz

#-----------------------------------EXECUTION---------------------------------->
DutchmanNL commented 11 months ago

Sure. Thanks for your fast answer.

great thank you! I will have a look at it, was just building also an LED light for my LaserCutter and used WLED. Will us that as test-device for ESPHome light part to see what's going wrong here.

Just to be sure: It worked before but since update to latest version its failing right ? (not that I am looking at an issue that was already there :))

DutchmanNL commented 11 months ago

ok I can reproduce it, the light component indeed looks to be broken by latest API integration so we will have to troubleshoot this one. What I see is that state on/off indeed still works as expected, but all light commandos result in an empty request to the ESP device

11:59:32 | [D] | [api.connection:1032] | iobrokerTest (192.168.88.102): Connected successfully
-- | -- | -- | --
11:59:57 | [D] | [light:036] | 'test_ch4' Setting:
12:00:30 | [D] | [switch:012] | 'TestSwitch' Turning ON.
12:00:30 | [D] | [switch:055] | 'TestSwitch': Sending state ON
12:00:35 | [D] | [switch:016] | 'TestSwitch' Turning OFF.
12:00:35 | [D] | [switch:055] | 'TestSwitch': Sending state OFF
12:02:24 | [I] | [ota:117] | Boot seems successful, resetting boot loop counter.
12:04:10 | [D] | [light:036] | 'test_ch4' Setting:
12:04:21 | [D] | [light:036] | 'test_ch4' Setting:
12:04:28 | [D] | [light:036] | 'test_ch4' Setting:
12:04:35 | [D] | [light:036] | 'test_ch4' Setting:
12:04:35 | [D] | [light:047] | State: ON

these entries were related to controlling the colours, as we see we get an empty request somehow

12:04:10 | [D] | [light:036] | 'test_ch4' Setting:
12:04:21 | [D] | [light:036] | 'test_ch4' Setting:
12:04:28 | [D] | [light:036] | 'test_ch4' Setting:
12:04:35 | [D] | [light:036] | 'test_ch4' Setting:
DutchmanNL commented 11 months ago

what I'm wondering, I don't see a color change possibility in the web interface, are we sure correct components are used?

Screenshot 2023-11-01 at 12 08 18

DutchmanNL commented 11 months ago

I can reproduce it also with an Neo-Pixel light component, so indeed looks like an issue with the integrated library

patricknitsch commented 11 months ago

I think that's ok, because it's only monochromatic light. You can only change the value for brightness. I also have rgb in use, there is the same problem

patricknitsch commented 11 months ago

And yes, before the update it works correctly

DutchmanNL commented 11 months ago

I think that's ok, because it's only monochromatic light. You can only change the value for brightness. I also have rgb in use, there is the same problem

Found the issue, we use an attribute to identify if its an controllable light and these values have been change in API. I modified the code and pusht version 0.3.2-beta.0 to git

Can you do me a favour please, install the version 0.3.2-beta.0 from git and test if it works now ? locally it looks good, but before making a new release which is deployed to all users I would like a double test from your side :)

patricknitsch commented 11 months ago

Awesome! I will test it and give you feedback.

patricknitsch commented 11 months ago

It works! tested it with monochromatic and rgb. Looks both good. Thanks for fixing it!

DutchmanNL commented 11 months ago

It works! tested it with monochromatic and rgb. Looks both good. Thanks for fixing it!

Perfect thank you, will release this version to NPM shortly so will be available tomorrow for everyone by admin

DutchmanNL commented 11 months ago

v0.3.2 released