I have an arduino sending me info about my electrical usage via serial. It comes as an amperage reading and then I multiply that by 120 to get my wattage for each phase respectively with a small offset for accuracy. This has been working fine for quite a while. I have been trying to get a total sum of the values it is giving me and the Riemann sum integration looks to be exactly what I need. However as soon as I add it to my configuration.yaml and restart hass it breaks the serial connection or something because the light on my arduino stays constantly on whereas normally it blinks when it sends something.
My configuration working fine:
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor:
- platform: serial
serial_port: /dev/ttyACM0
baudrate: 9600
template:
sensor:
- name: Phase 1 AC Current
unit_of_measurement: "A"
state: "{{ states('sensor.serial_sensor').split(',')[0] | float(default=0) - 0.25 }}"
- name: Phase 2 AC Current
unit_of_measurement: "A"
state: "{{ states('sensor.serial_sensor').split(',')[1] | float(default=0) - 0.25 }}"
- name: Total Wattage
unit_of_measurement: "W"
state: "{{ (states('sensor.serial_sensor').split(',')[1] | float(default=0) + states('sensor.serial_sensor').split(',')[0] | float(default=0) - 0.5 ) * 120 }}"
add this to the bottom to break everything:
sensor:
- platform: integration
source: sensor.total_wattage
name: energy_spent
unit_prefix: k
unit_time: h
round: 2
Hassio starts but the values for the serial sensor are undefined so it is like the integration integration is breaking something on the serial side.
I used the check configuration button and it says everything is fine.
Any idea what is going on here?
UPDATE: I Just checked and sensor.serial_sensor completely disappears from configuration>entities with the Integration Integration added. But if I remove it it works fine. How do I fix that?