Compare commits

..

No commits in common. "5b66f4718f9874093496b0f87308adf4018a169e" and "1b277eba0ca8aca09398eacb423914b19fb5a424" have entirely different histories.

4 changed files with 48 additions and 171 deletions

1
.gitignore vendored
View file

@ -6,4 +6,3 @@ __pycache__/
build/
tmp.*
drone/
*~

View file

@ -18,10 +18,48 @@ esp32:
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160: y
external_components:
- source:
type: local
path: components
logger:
http_request:
timeout: 30s
verify_ssl: false
api:
encryption:
key: !secret api_key
ota:
- platform: esphome
- platform: http_request
update:
- platform: http_request
id: auto_update
source: "https://juju.nz/michaelh/assets/esphome/${project_name}.json"
interval:
- startup_delay: 4hours
interval: 10min
then:
- update.perform: auto_update
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: "HIGH"
# Connect to the first AP found.
fast_connect: true
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Zurich
binary_sensor:
- platform: gpio
id: button
@ -31,6 +69,16 @@ binary_sensor:
inverted: true
name: "Button"
switch:
- platform: restart
name: "Restart"
- platform: template
name: "Update"
icon: "mdi:update"
turn_on_action:
then:
- update.perform: auto_update
light:
- platform: esp32_rmt_led_strip
id: led
@ -41,5 +89,3 @@ light:
rmt_channel: 0
chipset: ws2812
name: "LED"
<<: !include base.yaml

View file

@ -1,51 +0,0 @@
external_components:
- source:
type: local
path: components
logger:
http_request:
timeout: 30s
verify_ssl: false
api:
encryption:
key: !secret api_key
ota:
- platform: esphome
- platform: http_request
update:
- platform: http_request
id: auto_update
source: "https://juju.nz/michaelh/assets/esphome/${project_name}.json"
interval:
- startup_delay: 4hours
interval: 10min
then:
- update.perform: auto_update
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: "HIGH"
# Connect to the first AP found.
fast_connect: true
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Zurich
switch:
- platform: restart
name: "Restart"
- platform: template
name: "Update"
icon: "mdi:update"
turn_on_action:
then:
- update.perform: auto_update

View file

@ -1,117 +0,0 @@
substitutions:
device_name: PM6006 Amplifier
device_id: pm6006
project_name: juju.pm6006
extra_version: ""
project_version: "0.2${extra_version}"
esphome:
name: ${device_id}
name_add_mac_suffix: true
project:
name: "${project_name}"
version: "${project_version}"
platform: 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%
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
<<: !include base.yaml