substitutions: device_name: PM6006 Amplifier device_id: pm6006 project_name: juju.pm6006 extra_version: "" project_version: "0.8${extra_version}" esphome: name: ${device_id} name_add_mac_suffix: true friendly_name: "${device_name}" project: name: "${project_name}" version: "${project_version}" esp8266: board: modwifi status_led: pin: number: GPIO1 inverted: True binary_sensor: - platform: gpio name: "PM6006 power sense" id: pm6006_power_sense pin: number: 15 remote_transmitter: pin: number: GPIO13 carrier_duty_percent: 100% packages: base: !include base.yaml pm6006: switch: - platform: template name: "PM6006 power" icon: "mdi:power" lambda: |- if (id(pm6006_power_sense).state) { return true; } else { return false; } turn_on_action: if: condition: binary_sensor.is_off: pm6006_power_sense then: - remote_transmitter.transmit_rc5: address: 0x10 command: 0x0C # Needs to be sent twice to reliably wake up. repeat: 2 - delay: 500ms - if: # However, sometimes it turns on then off. Turn on again if so. condition: binary_sensor.is_off: pm6006_power_sense then: - remote_transmitter.transmit_rc5: address: 0x10 command: 0x0C repeat: 2 turn_off_action: if: condition: binary_sensor.is_on: pm6006_power_sense then: - remote_transmitter.transmit_rc5: address: 0x10 command: 0x0C repeat: 2 - delay: 500ms - if: # However, sometimes it doesn't turn off. condition: binary_sensor.is_on: pm6006_power_sense then: - remote_transmitter.transmit_rc5: address: 0x10 command: 0x0C repeat: 2 - platform: template name: "PM6006 volume up" icon: "mdi:volume-plus" turn_on_action: remote_transmitter.transmit_rc5: address: 0x10 command: 16 turn_off_action: remote_transmitter.transmit_rc5: address: 0x10 command: 16 - platform: template name: "PM6006 volume down" icon: "mdi:volume-minus" turn_on_action: remote_transmitter.transmit_rc5: address: 0x10 command: 17 turn_off_action: remote_transmitter.transmit_rc5: address: 0x10 command: 17 - platform: template name: "PM6006 mute" icon: "mdi:volume-mute" turn_on_action: remote_transmitter.transmit_rc5: address: 0x10 command: 13 turn_off_action: remote_transmitter.transmit_rc5: address: 0x10 command: 13