So now next step: trying to write a message using MQTT. now trying to set the ESS gridpoint.
The only thing I need to do is send payload: {“value”: 0.0} for grid setpoint 0, {“value”: -100.0}, {“value”: 100.0} and so on.
As in the TCP example I have set up a slider for this input in configuration.yaml:
input_number:
input_current_slider:
name: ESS Grid Target Value
min: -600 #update this to your maximum inverter capacity
max: 600 #update this to your maximum inverter capacity
step: 10 #this is the increment of the slider in watts. It can be as low as increments of 10.
And then I cant get the automation working:
need to send this payload to:
venus-home/W/VENUSSERIAL/settings/0/Settings/CGwacs/AcPowerSetPoint
This is what I have in my automations.yaml.
But the problem I think is that value is recognised in home assistant as something, but needs to be just parsed as text. Who with more MQTT knowledge can help?!
trigger:
- platform: state
entity_id: input_number.input_current_slider
to:
action:
- service: mqtt.publish
topic: venus-home/W/VENUSSERIAL/settings/0/Settings/CGwacs/AcPowerSetPoint
payload_template: "{"value": {{ trigger.to_state.state | round(1)}}}"
error message:
Error loading /config/configuration.yaml: mapping values are not allowed here
in "/config/automations.yaml", line 18, column 12```
I haven’t tried this myself yet, so I might have understood this the wrong way. Sorry if so.
I was investigating how to get this to work outside if local LAN, and came across this:
It mentions the current MQTT Implementation to change, in favor for a better, smaller and faster way. Will this change affect the topic of this post in any way?
It seems it’s will. I think the biggest concern is it said broker to broker bridging does not work with Flash yet.
But there is this action item:
“Finish broker to broker connection implementation into FlashMQ (action @wiebeytec )”
So hopefully that will not break anything if mosquito broker can still bridge to flashmq in the future.
Looks like as long as we don’t update your cerbo firmware nothing will change even once it’s released out of testing. So hopefully this current way will stay working for a long time as long as you disable auto updates on your cerbo.
I’ve been using the MQTT integration successfully for a few months now monitoring and controlling what’s available, but there is one setting that doesn’t seem to come through as an Entity in my setup. I’m trying to set the Max Charge Current for my Solar Charger via Home Assistant. I can see the current setting through MQTT Explorer (victron/N/############/solarcharger/279/Settings/ChargeCurrentLimit), but I’ve never had to set up my own custom switch for any Victron settings before. Is there a way similar to the examples above to create a Switch or other Entity in HA that will allow me to set the maximum charging current along a continuum from 0 to 70 amps? Or at least to set a switch with custom Low, Medium, and High settings that I can use? Sorry if this is very basic, but I have no experience with JSON, etc. Thanks in advance.
I’ve been able to publish through MQTT and get the value to change in what I can see through MQTT Explorer, but the setting is not going through to the actual solar charger. Is it possible that a setting like this is hard-wired to be read-only by Victron? Or is there some type of access setting I need to enable somewhere to authorize the change to “flow through” all the way to the Victron device itself?
replace victron/N/############/solarcharger/279/Settings/ChargeCurrentLimit with victron/W/############/solarcharger/279/Settings/ChargeCurrentLimit
So the /N/ is for reading, the /W/ is for writing the setting. Victron will read the setting and change the /N/ output. That way you see that the setting has actually changed.
Ok, now the W topic are beeing written, but when I change a number , for example
victron/W/48e7da865289/settings/0/Settings/CGwacs/BatteryLife/MinimumSocLimit
to for example 30 it’s value is changed to 30
but the value
victron/N/48e7da865289/settings/0/Settings/CGwacs/BatteryLife/MinimumSocLimit
does not change (stays at 10)
this also for other topics, do you know why? There is some protection somewhere?
Sensors work correctly. I can see by MQTT Explorer all values under victron/N/# .
Problem is, when I want change any value, it creates victron/W/… but it has no influence to values in victron setting and in victron/N/# .
Solved.
Problem was in MQTT broker, which didnt integrate file \share\mosquitto\victron.conf .
Because I created this file after Mosquitto instalation and configuration, I supposed file will be readed after Home Assistant restart. But it wasn’t. It was necessary go to Addons/Mosquitto , change the config, save and restart mosquitto. After that th config file in \share\mosquitto\ was readed and applied.
Morning, not sure if I’m doing something wrong, but everything was working till last week. So the sensor for the TimeToGo this is what I have based on the docs:
# Estimated Time until battery is empty based on current load.
# These calculations were copied from victrons code to mimic how they display it
- name: "Battery Remaining"
unique_id: "battery_remaining"
icon: mdi:timer-sand
state_topic: "victron/N/<hidden>/system/0/Dc/Battery/TimeToGo"
value_template: >
{% if value == '{"value": null}' %}
∞
{% else %}
{% set seconds = value_json.value | round(0) | int %}
{% set days = (seconds / 86400) | round(0, 'floor') | int %}
{% set hours = ((seconds - days * 86400) / 3600) | round(0, 'floor') | int %}
{% set minutes = ((seconds - hours * 3600) / 60) | round(0, 'floor') | int %}
{% if 2 > days >= 1 %}
{{days}} Day
{% elif days >= 2 %}
{{days}} Days
{% elif hours > 0 %}
{{hours}} Hours
{% elif minutes > 0 %}
{{minutes}} Minutes
{% else %}
∞
{% endif %}
{% endif %}
device:
{
identifiers: ["Victron Cerbo GX"],
manufacturer: "Victron Energy",
model: "Cerbo GX",
name: "Cerbo GX",
}
The sensor works, but by some reason when it goes from “time” back to null, the sensor state stays on the previous value that was a number, is anyone having the same issue? Seems it only started to happen recently, I tried recreate the sensor, add a new one and the same still happens. Looking at the MQTT this is what I have in the history.
But the sensor is at 10… .
Any idea what might be triggering this? Seems its ignoring the null…
Thanks for the detailed description. As I’m new to HA, it really saved me a lot of time.
Due to my setup, I have to use HA in docker and therefore some steps are slightly different. Nevertheless, it’s working.
Just for my understanding, why is the MQTT-Bridge needed? While I worked on the setup, I also got messages directly from the CCGX as it runs a MQTT broker itself.
Hi.
first, i have to say, that everything works really good. Thank you for the guide.
I have the following problem. If my Pi with Venus OS doesn’t send any data because it’s not reachable, for example. In homeassistant the last values are still shown to me.
How can you implement an availability query so that the sensors are displayed as unavailable in this case?