Closed Kranzy closed 3 years ago
Hey @sfeakes any idea when this change came in? I’m thinking of rolling my instal back to a previous version but because I skipped a few versions to the latest I’m not sure which version to roll back to?
Hi @sfeakes
Im having to replace the SD card in my pi this weekend.
Would love to run the latest version of the software but the wrong topic state for SWG is a breaker for me at the moment.
Are you going to continue developing this project? I understand if you're not, just want to look at my options moving forward.
Not sure how I missed this. I’ll take a look later in the week and fully understand what you mean. but quickly. I think you need to use both the enable and state Topics. You have several options so the SWG acts just like thermostat in automation hubs. You have (for thermostat) the following. Off (I’m not doing anything under any circumstances) Enabled (Ie I will turn on when I need to) Heating. Cooling.
Since. SWG is mimicking a thermostat in (cooling only) mode, you use both the enabled and state topics. Problem you have is SWG is never off (If it’s powered), so when you Set it to 0% generation , it should go into “enabled” state. But let me take a more detail look at this and home assistant.
So for me I am using the mqtt to create my own sensors/sliders etc. I am not setting it up as a climate unit so no need to adjust that side of it.
I use my own template to determine the different state based on the following
My variables based on the mqtt topics
swg_power_state_topic: aquapure/SWG
swg_power_command_topic: aquapure/SWG/set
swg_boost_state_topic: aquapure/SWG/Boost
swg_boost_command_topic: aquapure/SWG/Boost/set
swg_ppm_state_topic: aquapure/SWG/PPM
swg_full_status_state_topic: aquapure/SWG/fullstatus
Logic to show if it is off/on & status
platform: template
sensors:
swg_status_values:
friendly_name: "SWG Status"
value_template: >-
{% if is_state("sensor.swg_power_status", "0") %}
Off
{% elif is_state("sensor.swg_status", "0") %}
On
{% elif is_state("sensor.swg_status", "1") %}
No Flow
{% elif is_state("sensor.swg_status", "2") %}
Low Salt
{% elif is_state("sensor.swg_status", "4") %}
High Salt
{% elif is_state("sensor.swg_status", "8") %}
Clean Cell
{% elif is_state("sensor.swg_status", "9") %}
Turning Off
{% elif is_state("sensor.swg_status", "16") %}
High Current
{% elif is_state("sensor.swg_status", "32") %}
Low Volts
{% elif is_state("sensor.swg_status", "64") %}
Low Temp
{% elif is_state("sensor.swg_status", "128") %}
Check PCB
{% elif is_state("sensor.swg_status", "254") %}
No Connection to SWG
{% elif is_state("sensor.swg_status", "255") %}
No Connection to SWG
{%- endif %}
It was only when updating to the latest version that I was having issues. should my 'swg_power_state_topic' be aquapured/SWG/enabled??
I should also note that I have clean cell showing on my SWG currently but that is not being shown in aquapure, unsure if the log above is enough for you to see if it should be.
Hi @sfeakes did you end up getting a chance to look at this? It looks like aquapure/SWG/enabled is publishing 2 when switching the SWG on and off from the web interface. aquapure/SWG set to 0 turns it off as expected, but then publishes a 2 which tells my switch it is back on but it is still off in the webui.
@sfeakes are you able to confirm that the 'SWG' topic should be reporting 0 when its off, and the 'SWG/enabled' topic is when connected to the SWG.
I guess my end result is I am looking to have an on/off switch to control the SWG, which had been working great up until an update or two ago (I am not exactly sure which update changed it)
Ok so I ended up getting around this issue by using the state topic as aquapured/SWG/Percent and in my mqtt switch settings using a value template value_template: "{% if value == '0' %}OFF{% else %}ON{% endif %}"
This now gives me the switch to turn the chlorinator on/off and have the correct switch state shown.
As most people use the climate option to set this up I am happy to close this one out now I have a solution that didnt require any code changes.
Hi @sfeakes,
I have just updated to the latest release and noticed my switch in home assistant won't show off status. Always returns to on once switched. The actual pump turns on and off as expected.
Looking at the logs below, even when it receives SWG/set/0 it publishes /SWG 2 causing the switch state to not be accurate.