ESPHOME light platform GPIO PCF8574 - problem

Hello.
I have that part of the yaml file

i2c:                                                                            
  sda: D2                                                                       
  scl: D1                                                                       
  scan: True                                                                    
  id: i2c_bus                                                                   
                                                                                
pcf8574:                                                                        
  - id: pcf_expander                                                            
    address: 0x38                                                               
                                                                                
light:                                                                          
  - platform: gpio                                                              
    name: ${devicename} - left bulb                                             
    id: relay_1                                                                 
    pin:                                                                        
     pcf8574: pcf_expander                                                      
     number: 4                                                                  
     # One of INPUT, INPUT_PULLUP or OUTPUT                                     
     mode: OUTPUT                                                               
     inverted: True

unfortunately gets a mistake

Failed config

light.gpio: [source bathroom.yaml:48]
  
  Platform not found: 'light.gpio'.
  platform: gpio
  name: wemos_bathroom - left bulb
  id: relay_1
  pin: 
    pcf8574: pcf_expander
    number: 4
    mode: OUTPUT
    inverted: True

what I’m doing wrong

Using a non-existent light platform. There is no platform: gpio for light.

The allowable light platforms are: https://esphome.io/index.html#light-components.

Thank You for the quick reply.
It is a pity that you can not be as GPIO.
So I’ll have to change the icon

greetings

I’m not sure what you mean by that.

Just use a binary light and point it at a gpio output.

I wanted to get the lamp icon at the switch in HA. It seemed to me that the easiest way to do this is to change the “switch” to “lamp”. As a last resort I did it by adding the “icon” option
icon: "mdi: lightbulb".
It worked, but now there is another problem :), because when the light is ON, the color of the lamp does not change

Thank You - it works!
My configuration look’s like this:

output:                                                                         
  - platform: gpio                                                              
    id: relay_1                                                                 
    pin:                                                                        
     pcf8574: pcf_expander                                                      
     number: 4                                                                  
     # One of INPUT, INPUT_PULLUP or OUTPUT                                     
     mode: OUTPUT                                                               
     inverted: True                                                             
                                                                                
  - platform: gpio                                                              
    id: relay_2                                                                 
    pin:                                                                        
      pcf8574: pcf_expander                                                     
      number: 5                                                                 
      # One of INPUT, INPUT_PULLUP or OUTPUT                                    
      mode: OUTPUT                                                              
      inverted: True                                                            
                                                                                
  - platform: gpio                                                              
    id: relay_3                                                                 
    pin:                                                                        
      pcf8574: pcf_expander                                                     
      number: 6                                                                 
      # One of INPUT, INPUT_PULLUP or OUTPUT                                    
      mode: OUTPUT                                                              
      inverted: True 
                                                                         
  - platform: gpio                                                              
    id: relay_4                                                                 
    pin:                                                                        
      pcf8574: pcf_expander                                                     
      number: 7                                                                 
      # One of INPUT, INPUT_PULLUP or OUTPUT                                    
      mode: OUTPUT                                                              
      inverted: True                                                            
                                                                                
light:                                                                          
  - platform: binary                                                            
    name: ${devicename} - left bulb                                             
    output: relay_1                                                             
    id: left_bulb                                                               
                                                                                
  - platform: binary                                                            
    name: ${devicename} - right bulb                                            
    output: relay_2                                                             
    id: right_bulb                                                              
                                                                                
  - platform: binary                                                            
    name: ${devicename} - door bulb                                             
    output: relay_3                                                             
    id: door_bulb                                                               
                                                                                
  - platform: binary                                                            
    name: ${devicename} - window bulb                                           
    output: relay_4                                                             
    id: window_bulb    
1 Like