Closed johnvanl closed 1 year ago
I think this has something to do with this change: https://github.com/serkri/SmartEVSE-3/commit/1760697216d7862b63901f449a6d27d80ae5e8ac
I've got a similar setup where I'm doing a post from HA every time a value from the P1 comes in, but at least once a minute, as the amperage entities don't necessarily update at least every minute. That said, I don't run the latest firmware yet. Otherwise I would have encountered the same problem.
Automation:
alias: P1 naar SmartEVSE
description: ""
trigger:
- platform: state
entity_id:
- sensor.current_phase_l1
- platform: state
entity_id:
- sensor.current_phase_l2
- platform: state
entity_id:
- sensor.current_phase_l3
- platform: state
entity_id:
- sensor.power_production_phase_l1
from: "0"
- platform: state
entity_id:
- sensor.power_consumption
to: "0"
- platform: time_pattern
seconds: "0"
id: every_minute
condition:
- condition: or
conditions:
- condition: not
conditions:
- condition: trigger
id: every_minute
- condition: template
value_template: >-
{{ (as_timestamp(now()) -
as_timestamp(state_attr('automation.p1_naar_smartevse',
'last_triggered'))) >= 59 }}
action:
- service: rest_command.send_smartevse_currents
data: {}
mode: single
REST command:
rest_command:
send_smartevse_currents:
url: 'http://smartevse-XXXXX.lan/currents?L1={{ (states("sensor.current_phase_l1") | int) * 10 * (-1 if (states("sensor.power_production_phase_l1") | float) > 0 else 1) }}&L2={{ (states("sensor.current_phase_l2") | int) * 10 }}&L3={{ (states("sensor.current_phase_l3") | int) * 10 }}'
method: post
That change is implementing a safety feature: if you cannot provide accurate current information within every 10 seconds, SmartEVSE cannot do what it promises (guard currents in Smart mode, dynamic charging in Solar mode).
Homeassistant is ideal to read/write non-timecritical data, but (AFAIK) not meant for these kinds of update intervals. So better have some script load your P1 data directly into SmartEVSE (it monitors every 100ms), and from there load it into Homeassistant ....
I am using Smart EVSE V3 Version: SERKRI-1.4.4 in combi with Home Assistant. And in stead of the p1-cable I am using the API with POST/currents.
In my configuration: laadpaal_share_p1: url: http:///currents?L1={{ states('sensor.current_phase_l1')|float10 }}&L2={{states('sensor.current_phase_l2')|float10 }}&L3={{ states('sensor.current_phase_l3')|float*10 }}
method: POST
In my automation:
action:
service: rest_command.laadpaal_share_p1
This works fine. But I have learned that I have to POST at least every 10 seconds otherwise I will get an "Error: Communication Error" which will be solved with one (or some) new POST(s). My intention was to POST only when the current changes and the smart EVSE is <> OFF. I can understand that the Smart EVSE wants an update regularly. Is this 10 seconds maximum (and always needed even when it is OFF) or is there an option to optimize and mimimize the number of POSTs?