Thanks, after a lot of playing around last night, I also got it running - at least the sensors:
# wallbox
modbus:
- name: wallbe
type: tcp
host: 192.168.0.8
port: 502
sensors:
- name: Lade-Zeit
unit_of_measurement: h
slave: 255
address: 102
precision: 1
scale: 0.000277777777
- name: Lade-Strom
slave: 255
address: 528
scale: 0.1
unit_of_measurement: A
device_class: current
- name: Lade-Status
slave: 255
address: 100
device_class: battery
but the switches from your syntax are something I might take over, as well as the additional error code sensor ;-).
In addition to the basic sensors, I created one for the status, assigning texts and icons to the states (info taken from the Phoenix documentation), so I have a more beautiful display on Lovelace. Unfortunately it’s in German, but might also give others an idea how do to such “mappings”:
template:
- sensor:
- name: "Wallbox Status"
state: >
{% if is_state('sensor.lade_status', '65') %}
kein Fahrzeug
{% elif is_state('sensor.lade_status', '66') %}
Fahrzeug lädt nicht
{% elif is_state('sensor.lade_status', '67') %}
Fahrzeug lädt
{% elif is_state('sensor.lade_status', '68') %}
Fahrzeug lädt
{% elif is_state('sensor.lade_status', '69') %}
Fehler, nicht bereit
{% elif is_state('sensor.lade_status', '70') %}
Laden nicht verfügbar
{% else %}
Unbekannt
{% endif %}
icon: >
{% if is_state('sensor.lade_status', '65') %}
mdi:power-plug-off
{% elif is_state('sensor.lade_status', '66') %}
mdi:car-outline
{% elif is_state('sensor.lade_status', '67') %}
mdi:battery-charging
{% elif is_state('sensor.lade_status', '68') %}
mdi:battery-charging
{% elif is_state('sensor.lade_status', '69') %}
mdi:battery-alert
{% elif is_state('sensor.lade_status', '70') %}
mdi:battery-alert
{% else %}
mdi:battery-unknown
{% endif %}
Note that I read the register as int16 (default), so I have to switch by ASCII codes, not the actual string representation A…F. That allows displaying something like the following: