Acties:
  • 0 Henk 'm!

  • PurpleBlue
  • Registratie: Oktober 2004
  • Niet online
Even een vraagje vanuit mijn kant,

Ik heb een Xiomi Mi Led Desk Lamp 1S, en deze is voorzien van ESPHome.
Na verhuizing/verbouwing heb ik deze weer tevoorschijn gehaald, en is hij in Home Assistant wel online, maar
kan ik hem niet bedienen.

Nu zie ik dat er een nieuwe versie beschikbaar is, maar bij het updaten loopt hij vast:
YAML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-arduinoespressif32 @ 0.0.0+sha.a205eef 
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- WiFi @ 1.0
|-- ESPmDNS @ 1.0
|-- Update @ 1.0
Compiling /data/mi-desk-lamp-1s/.pioenvs/mi-desk-lamp-1s/src/esphome/components/ledc/ledc_output.cpp.o
Compiling /data/mi-desk-lamp-1s/.pioenvs/mi-desk-lamp-1s/src/esphome/components/light/esp_range_view.cpp.o
src/esphome/components/ledc/ledc_output.cpp: In member function 'virtual void esphome::ledc::LEDCOutput::update_frequency(float)':
src/esphome/components/ledc/ledc_output.cpp:188:3: error: 'u_int32_t' was not declared in this scope
   u_int32_t configured_frequency = 0;
   ^
src/esphome/components/ledc/ledc_output.cpp:192:35: error: 'configured_frequency' was not declared in this scope
   while (attempt_count_max > 0 && configured_frequency == 0) {
                                   ^
src/esphome/components/ledc/ledc_output.cpp:209:7: error: 'configured_frequency' was not declared in this scope
   if (configured_frequency == 0) {
       ^
*** [/data/mi-desk-lamp-1s/.pioenvs/mi-desk-lamp-1s/src/esphome/components/ledc/ledc_output.cpp.o] Error 1

(ESPHome integratie in Home Assistant is up2date)

De ESPHome code:
YAML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
substitutions:
    devicename: mi-desk-lamp-1s
    lightname: Bureaulamp

esphome:
  name: $devicename
  platformio_options:
    platform_packages:
      - framework-arduinoespressif32 @ https://github.com/pauln/arduino-esp32.git#solo-no-mac-crc/1.0.6
    platform:
      - espressif32@1.11.0
  
esp32:
  board: esp32doit-devkit-v1

    
wifi:
  ssid: !secret wifi_ssid1
  password: !secret wifi_password1

api:
  password: !secret Desklight_password

ota:
  password: !secret Desklight_password

logger:

sensor:
  - platform: rotary_encoder
    name: "Rotary decoder"
    id: rotation
    pin_a: GPIO27
    pin_b: GPIO26
    resolution: 2
    on_value:
      # Draait iemand aan de knop?
      then: 
        - if:
            #Ga na of de lamp aan staat?
            condition:
              - light.is_on: light1
              
            then: 
            # Staat de lamp aan, ga kijken of hij is ingedukt
            - if:
                condition:
                    - lambda: 'return id(button).state;'
                    
                then:
                  # Ja, knop ingedrukt, stel temperatuur in
                  - lambda: |-
                      auto min_temp = id(light1).get_traits().get_min_mireds();
                      auto max_temp = id(light1).get_traits().get_max_mireds();
                      auto cur_temp = id(light1).current_values.get_color_temperature();
                      auto new_temp = max(min_temp, min(max_temp, cur_temp + (x*10)));
                      auto call = id(light1).turn_on();
                      call.set_color_temperature(new_temp);
                      call.perform();
                      
                else:
                  # niet ingedrukt, stel felheid in
                  - light.dim_relative:
                     id: light1
                     relative_brightness: !lambda |-
                        return x / 20.0;
                        
            # Reset de waarde          
            - sensor.rotary_encoder.set_value:
                id: rotation
                value: 0

binary_sensor:
  - platform: gpio
    #name: "Draaiknop"
    id: button
    pin:
      number: GPIO33
      inverted: True
      mode: INPUT_PULLDOWN

    on_multi_click:    
    #Single click
    - timing:
        - ON for at most 0.5s
        - OFF for at least 0.4s
      then:
        - logger.log: "Single short Click"
        - light.toggle: light1
    
    #Double Click    
    - timing:
        - ON for at most 0.4s
        - OFF for at most 0.4s
        - ON for at most 0.4s
        - OFF for at least 0.2s
      then:
        - logger.log: "Double Clicked"
        - homeassistant.service:
            service: switch.toggle
            data:
              entity_id: switch.zigbee_powerplug
 

output:
  - platform: ledc
    pin: GPIO2
    id: output_cw
    min_power: 0.05
    power_supply: power
  - platform: ledc
    pin: GPIO4
    id: output_ww
    min_power: 0.05
    power_supply: power
    
power_supply:
  - id: power
    pin: GPIO12
    enable_time: 0s
    keep_on_time: 0s

light:
  - platform: cwww
    id: light1
    default_transition_length: 0s
    constant_brightness: true
    name: $lightname
    cold_white: output_cw
    warm_white: output_ww
    cold_white_color_temperature: 5000 K
    warm_white_color_temperature: 2600 K
    effects:
      - pulse:
          name: "Pulse"
          transition_length: 0.5s
          update_interval: 0.5s


Zelf heb ik het idee dat het in het board gedeelte zit, maar kom er niet uit.
Wie ziet/weet wat ik anders kan doem om hem te kunnen updaten? :)

[ Voor 4% gewijzigd door PurpleBlue op 10-03-2023 14:08 ]


Acties:
  • +1 Henk 'm!

  • AUijtdehaag
  • Registratie: Oktober 2006
  • Niet online

PVOutput Github - Div ESP TK: MHI - Clack - Marstek


Acties:
  • +1 Henk 'm!

  • PurpleBlue
  • Registratie: Oktober 2004
  • Niet online
Dank je, ga ik naar kijken.

update: Dit werkte inderdaad! Dank :)

[ Voor 8% gewijzigd door PurpleBlue op 12-03-2023 13:35 ]