libretiny
libretiny copied to clipboard
t102-v1.1 PA15 pin issues
Hi. I have a generic smart socket with energy monitor based on t102 board. It has connected BL0937's SEL pin to PA15, so according to #155, i am used version: 1.6.0 to avoid the bootlop. But looks like the pin just does not work anymore, i have created the gpio switch to manually switch between voltage and current and it is still reports the same values. After changing to board: wr2, it worked:
[14:12:23][D][sensor:093]: 'rtlsocket_voltage': Sending state 0.43395 V with 1 decimals of accuracy
[14:12:23][D][sensor:093]: 'rtlsocket_power': Sending state 2.02600 W with 1 decimals of accuracy
[14:12:23][D][sensor:093]: 'rtlsocket_energy': Sending state 0.47667 Wh with 1 decimals of accuracy
[14:12:26][D][hlw8012:082]: Got power=2.7W, voltage=0.4V
[14:12:26][D][sensor:093]: 'rtlsocket_voltage': Sending state 0.37196 V with 1 decimals of accuracy
[14:12:26][D][sensor:093]: 'rtlsocket_power': Sending state 2.70133 W with 1 decimals of accuracy
[14:12:26][D][sensor:093]: 'rtlsocket_energy': Sending state 0.47892 Wh with 1 decimals of accuracy
[14:12:26][D][switch:012]: 'rtlsocket_sel_switch' Turning ON.
[14:12:26][D][switch:055]: 'rtlsocket_sel_switch': Sending state ON
[14:12:29][D][hlw8012:082]: Got power=2.7W, voltage=327.1V
[14:12:29][D][sensor:093]: 'rtlsocket_voltage': Sending state 327.07501 V with 1 decimals of accuracy
[14:12:29][D][sensor:093]: 'rtlsocket_power': Sending state 2.70133 W with 1 decimals of accuracy
[14:12:29][D][sensor:093]: 'rtlsocket_energy': Sending state 0.48117 Wh with 1 decimals of accuracy
[14:12:32][D][sensor:093]: 'rtlsocket_power': Sending state 2.70133 W with 1 decimals of accuracy
[14:12:32][D][sensor:093]: 'rtlsocket_energy': Sending state 0.48343 Wh with 1 decimals of accuracy
Don't mind the values, it is still uncalibrated, but at least now i can calibrate. So looks like the last commit just prevents 15 pin from changing the state for t102.
Full configuration:
rtl87xx:
board: wr2
framework:
version: 1.6.0
switch:
- platform: gpio
pin: 0
name: ${hostname}_switch
id: ${hostname}_switch
restore_mode: ALWAYS_OFF
device_class: outlet
- platform: gpio
pin:
number: 15
allow_other_uses: true
name: ${hostname}_sel_switch
id: ${hostname}_ssel_switch
restore_mode: ALWAYS_OFF
binary_sensor:
- platform: gpio
pin:
number: 18
mode: INPUT_PULLUP
inverted: true
name: ${hostname}_button
on_release:
- switch.toggle: ${hostname}_switch
status_led:
pin:
number: 23
inverted: true
sensor:
- platform: hlw8012
model: BL0937
sel_pin:
number: PA15
allow_other_uses: true
#inverted: true
cf_pin: #D1 #4
number: PA5
cf1_pin: #D0 #5
number: PA12
current:
name: ${hostname}_current
voltage:
name: ${hostname}_voltage
power:
name: ${hostname}_power
energy:
name: ${hostname}_energy
#voltage_divider: 860
current_resistor: 0.001
update_interval: 3s
#initial_mode: CURRENT
change_mode_every: 8