Ahh, I found the problem.
The topic victron/N/<VRM ID>/system/0/DynamicEss/Active
is not editable, even with the victron/W/<VRM ID>/system/0/DynamicEss/Active
. I’m not sure what this topic covers as after more time, I’ve realised it doesn’t always reflect reality.
The topic W
write path is actually victron/W/<VRM ID>/settings/0/Settings/DynamicEss/Mode
where 0 is disabled and 1 is enabled. I’m not sure what the values 2 to 4 mean as they’re valid states apparently.
The same topic but with N
should be used to poll current status.
The working YAML is:
mqtt:
switch:
- name: "Victron AC Power Toggle"
unique_id: victron_ac_power_toggle
state_topic: "victron/N/<VRM ID>/settings/0/Settings/CGwacs/AcPowerSetPoint"
value_template: >
{% if value_json.value == -5000 %}
ON
{% else %}
OFF
{% endif %}
state_on: "ON"
state_off: "OFF"
command_topic: "victron/W/<VRM ID>/settings/0/Settings/CGwacs/AcPowerSetPoint"
payload_on: '{"value": -5000}'
payload_off: '{"value": -10}'
retain: true
- name: "Victron Dynamic ESS"
unique_id: 0907ca95-e82b-461a-9094-2998a8ec803b
state_topic: "victron/N/<VRM ID>/settings/0/Settings/DynamicEss/Mode"
value_template: >
{% if value_json.value == 1 %}
ON
{% else %}
OFF
{% endif %}
state_on: "ON"
state_off: "OFF"
command_topic: "victron/W/<VRM ID>/settings/0/Settings/DynamicEss/Mode"
payload_on: '{"value": 1}'
payload_off: '{"value": 0}'
retain: true
It’s now working and also reflects the current state and if I change it in VRM. I’m happy