NeoPool - Home Assistant integration #19811
Replies: 11 comments 26 replies
-
The simple controls could be solved via the ESP82xx definition (using dummy relays and rules) - no berry scripting neccessary. If you also use user defined NeoPool commands (for the NPAux cmnd), the configuration e. g. for Atom Lite look like this: Backlog GPIO12 224;GPIO13 225;GPIO14 226;GPIO15 227;GPIO18 228;GPIO20 229 Label WebUI buttons Backlog WebButton1 Aux1;WebButton2 Aux2;WebButton3 Aux3;;WebButton4 Aux4;WebButton5 Filtration;WebButton6 Light Define rule1 Rule1
ON Power1#State==0 DO NPAux1 %value% ENDON
ON Power1#State==1 DO NPAux1 %value% ENDON
ON NeoPool#Relay#Aux[1]#State==0 DO Power1 %value% ENDON
ON NeoPool#Relay#Aux[1]#State==1 DO Power1 %value% ENDON
ON Power2#State==0 DO NPAux2 %value% ENDON
ON Power2#State==1 DO NPAux2 %value% ENDON
ON NeoPool#Relay#Aux[2]#State==0 DO Power2 %value% ENDON
ON NeoPool#Relay#Aux[2]#State==1 DO Power2 %value% ENDON
ON Power3#State==0 DO NPAux3 %value% ENDON
ON Power3#State==1 DO NPAux3 %value% ENDON
ON NeoPool#Relay#Aux[3]#State==0 DO Power3 %value% ENDON
ON NeoPool#Relay#Aux[3]#State==1 DO Power3 %value% ENDON
ON Power4#State==0 DO NPAux4 %value% ENDON
ON Power4#State==1 DO NPAux4 %value% ENDON
ON NeoPool#Relay#Aux[4]#State==0 DO Power4 %value% ENDON
ON NeoPool#Relay#Aux[4]#State==1 DO Power5 %value% ENDON
Rule1+
ON Power5#State==0 DO NPFiltration %value% ENDON
ON Power5#State==1 DO NPFiltration %value% ENDON
ON NeoPool#Filtration#State==0 DO Power5 %value% ENDON
ON NeoPool#Filtration#State==1 DO Power5 %value% ENDON
ON Power6#State==0 DO NPLight %value% ENDON
ON Power6#State==1 DO NPLight %value% ENDON
ON NeoPool#Light==0 DO Power6 %value% ENDON
ON NeoPool#Light==1 DO Power6 %value% ENDON Enable rule1 Backlog Rule1 5;Rule1 1 (important to use one-shot rule for this as described) |
Beta Was this translation helpful? Give feedback.
-
So, if I understood correctly, in order to have switches entities in Home Assistant, I need to define dummy relays and the rule managing their logic, both on ESP82xx and ESP32. The berry script is just a way to define the NPAux and NPBoost commands and the UI elements on ESP32. Correct? Having said that, since I'd like to have switches on HA for everything possible, I can always add more dummy relays, for example if I want a switch for boost mode, correct? Even though, boost mode like pump speed are not actually switches but selects because they have more than 2 possible states. I wonder how the HA integration module in Tasmota works on these things, so we can better configure NeoPool. Curiosities: why did you skip GPIO19 in the dummy relay example above? Also: is there a way to rename the system model? I have an Hayward Aquarite+, and it comes out as "Generic" I wonder if there's an option somewhere to change/customize it. I know that it probably comes out of the register map itself, maybe there's a way to define that somewhere. Thanks. Thank you very much for the help. |
Beta Was this translation helpful? Give feedback.
-
I have some HA knowledge, and since I don't like the dummy relays config, what would be the best way to integrate HA with NeoPool driver on Tasmota? MQTT? I'm thinking about the integration at protocol level. A custom component could be created in HA, that interfaces NeoPool. I created a modbus custom component for my solar inverter (ABB), but the use case is different here, since NeoPool driver already takes care of the modbus register map, etc. Please tell me how you would think doing it, so I can think about the HA side (python based). |
Beta Was this translation helpful? Give feedback.
-
I don't want to do it, since there's a good driver you developed for Tasmota. But there's obviously a missing area regarding the integration: relays (and other entities) have to be created manually in the automation platform, and that is another thing to maintain etc. One of the benefits of choosing Tasmota is the automatic integration in HA. Question: can the driver create the relays etc. in Tasmota so they would automatically be available in HA?
Correct, and that's how I integrated most things. But trust me, for the average user it's not really easy to implement/maintain. My goal was coming up with a really easy way to integrate it (and maintain it), but that's not the case right now. I will complete the MQTT integration with most of the needed entities, but I will also look at HACO that is the replacement of HCT. Right now I only have 5 entities, 2 switches and 3 selects, I'll complete this with the rest: mqtt:
switch:
- unique_id: "smartpool_neopool_filtration_switch"
name: "SmartPool Neopool Filtration Switch"
device_class: switch
command_topic: "cmnd/SmartPool/NPFiltration"
state_topic: "tele/SmartPool/SENSOR"
value_template: >-
{{ value_json.NeoPool.Filtration.State }}
state_on: "1"
state_off: "0"
payload_on: "1"
payload_off: "0"
availability_topic: "tele/SmartPool/LWT"
payload_available: "Online"
payload_not_available: "Offline"
- unique_id: "smartpool_neopool_lights"
name: "SmartPool Neopool Lights"
device_class: switch
command_topic: "cmnd/SmartPool/NPLight"
state_topic: "tele/SmartPool/SENSOR"
value_template: >-
{{ value_json.NeoPool.Light }}
state_on: "1"
state_off: "0"
payload_on: "1"
payload_off: "0"
availability_topic: "tele/SmartPool/LWT"
payload_available: "Online"
payload_not_available: "Offline"
select:
- unique_id: "smartpool_neopool_filtration_mode"
name: "SmartPool Neopool Filtration Mode"
command_topic: "cmnd/SmartPool/NPFiltrationMode"
state_topic: "tele/SmartPool/SENSOR"
command_template: >-
{% set values = { 'Manual':'0', 'Auto':'1', 'Heating':'2', 'Smart':'3', 'Intelligent':'4', 'Backwash':'13' } %}
{{ values[value] if value in values.keys() }}
value_template: >-
{% set values = { 0:'Manual', 1:'Auto', 2:'Heating', 3:'Smart', 4:'Intelligent', 13:'Backwash' } %}
{{ values[value_json.NeoPool.Filtration.Mode] if value_json.NeoPool.Filtration.Mode in values.keys() }}
# options: ["0", "1", "2", "3", "4", "13"]
options: ["Manual", "Auto", "Heating", "Smart", "Intelligent", "Backwash"]
- unique_id: "smartpool_neopool_filtration_speed"
name: "SmartPool Neopool Filtration Speed"
command_topic: "cmnd/SmartPool/NPFiltration"
state_topic: "tele/SmartPool/SENSOR"
command_template: >-
{% set values = { 'Slow':'1', 'Medium':'2', 'Fast':'3' } %}
{% if is_state('sensor.smartpool_neopool_filtration_state', '1') %}
{{ '1 ' + values[value] if value in values.keys() }}
{% elif is_state('sensor.smartpool_neopool_filtration_state', '0') %}
{{ '0 ' + values[value] if value in values.keys() }}
{% endif %}
value_template: >-
{% set values = { 1:'Slow', 2:'Medium', 3:'Fast' } %}
{{ values[value_json.NeoPool.Filtration.Speed] if value_json.NeoPool.Filtration.Speed in values.keys() }}
options: ["Slow", "Medium", "Fast"]
- unique_id: "smartpool_neopool_boost_mode"
name: "SmartPool Neopool Boost Mode"
command_topic: "cmnd/SmartPool/NPBoost"
state_topic: "tele/SmartPool/SENSOR"
command_template: >-
{% set values = { 'Off':'0', 'On':'1', 'On (Redox)':'2' } %}
{% if is_state('sensor.smartpool_neopool_filtration_state', '1') %}
{{ values[value] if value in values.keys() else '99' }}
{% endif %}
value_template: >-
{% set values = { 0:'Off', 1:'On', 2:'On (Redox)' } %}
{{ values[value_json.NeoPool.Hydrolysis.Boost] if value_json.NeoPool.Hydrolysis.Boost in values.keys() }}
options: ["Off", "On", "On (Redox)"] |
Beta Was this translation helpful? Give feedback.
-
@curzon01 Norbert, there is some data in the JSON that I'm not 100% sure how to manage because I'm not sure of what it represents. Below you can find an example of my Aquarite+ json data, I added comments with sensor type (switch, binary_switch, sensor, binary_sensor, number, select) based on my understanding, and the description. switch/binary_switch/number/select are all configurable/actionable, sensors aren't. I added Data that doesn't have a comment means I don't think it's valuable to integrate it in HA, but let me know if you think I overlooked anything. Thanks for the help. {
"Time": "2023-10-23T21:31:38",
"NeoPool": {
"Time": "2023-10-23T21:31:37",
"Type": "Generic", // SENSOR - System Type/Model
"Modules": {
"pH": 1, // BINARY_SENSOR - Module Presence
"Redox": 1, // BINARY_SENSOR - Module Presence
"Hydrolysis": 1, // BINARY_SENSOR - Module Presence
"Chlorine": 0, // BINARY_SENSOR - Module Presence
"Conductivity": 0, // BINARY_SENSOR - Module Presence
"Ionization": 0 // BINARY_SENSOR - Module Presence
},
"Temperature": 20.1, // SENSOR - Water Temperature
"Power": {
"Version": "V5.0", // SENSOR - ???
"NodeID": "XXXX 0051 XXXX XXXX YYYY XXXX", // SENSOR - ???
"5V": 5, // SENSOR - ???
"12V": 14, // SENSOR - ???
"24-30V": 34, // SENSOR - ???
"4-20mA": 0.070 // SENSOR - ???
},
"pH": {
"Data": 7.4, // SENSOR - pH Measurement
"Min": 7.2, // NUMBER - pH Min Value (0-14)
"Max": 7.4, // NUMBER - pH Max Value (0-14)
"State": 0, // BINARY_SENSOR - ???
"Pump": 0, // BINARY_SENSOR - Pump Activation State
"FL1": 0, // BINARY_SENSOR - ???
"Tank": 1 // BINARY_SENSOR - Empty Acid Tank
},
"Redox": {
"Data": 540, // Sensor - Redox Measurement
"Setpoint": 730 // NUMBER - Redox Setpoint (0-100)
},
"Hydrolysis": {
"Data": 0, // NUMBER - Chlorine Production Value (0-100)
"Unit": "g/h",
"Runtime": {
"Total": "44T23:55:26", // SENSOR - Cell Total Runtime (format ???)
"Part": "44T23:55:26", // SENSOR - ???
"Pol1": "22T18:44:42", // SENSOR - Cell Total Runtime at Pol1
"Pol2": "22T05:10:44", // SENSOR - Cell Total Runtime at Pol2
"Changes": 386 // SENSOR - Cell Total Polarity Switches (???)
},
"State": "Flow", // SENSOR - Cell Production State (Flow/Pol1/Pol2/OFF)
"Cover": 0, // BINARY_SENSOR - Cover State (Open/Closed)
"Boost": 0, // SELECT - Cell Boost State (On/On+Redox/Off)
"Low": 0 // BINARY_SENSOR - Low Production Alarm
},
"Filtration": {
"State": 0, // SWITCH - Filtration Activation
"Speed": 1, // SELECT - Filtration Speed (Multiple values)
"Mode": 0 // SELECT - Filtration Speed (Multiple values)
},
"Light": 0, // SWITCH - Light Relay Activation
"Relay": {
"State": [
0, // BINARY_SENSOR - pH Relay State
0, // BINARY_SENSOR - Filtering Relay State
0, // BINARY_SENSOR - Lights Relay State
0, // BINARY_SENSOR - AUX1 Relay State
0, // BINARY_SENSOR - AUX2 Relay State
0, // BINARY_SENSOR - AUX3 Relay State
0 // BINARY_SENSOR - AUX4 Relay State
],
"Aux": [
0, // BINARY_SENSOR - AUX1 Relay State
0, // BINARY_SENSOR - AUX2 Relay State
0, // BINARY_SENSOR - AUX3 Relay State
0 // BINARY_SENSOR - AUX4 Relay State
],
"Acid": 0 // BINARY_SENSOR - Acid Pump Relay State
}
},
"TempUnit": "C"
} |
Beta Was this translation helpful? Give feedback.
-
I have to check if HA can digest that format, otherwise I'll need to use a template that converts it first.
Indeed, it depends on the device configuration, but I haven't found a setting on the Aquarite+ display to change g/h in % mode. Documentation says it should be possible, but I don't know how. Actually % makes more sense so users won't have to bother about checking the max cell production value.
I use HA Core (in a Proxmox LXC with Docker installed). Indeed, the native tasmota-HA integration sensors throw those errors on those two entities: I disabled them. Actually, once my MQTT integration is complete, I want to disable the integration of that tasmota device completely. Is there a way to disable HA integration on tasmota?
I confirm the resolution of the mA sensor is fine, I double-checked with the value on Aquarite+ display. Initially it seemed off, my bad.
Agreed. Regarding my MQTT integration, I'd prefer not to share it publicly right now because it's not 100% tested, tell me how I can send it to you privately. I'm available on Discord and Telegram as @alexdelprete if you use one of those services. Or tell me how I can send it to you. :) |
Beta Was this translation helpful? Give feedback.
-
Understood now.
I knew about
Will send you an email. |
Beta Was this translation helpful? Give feedback.
-
I know how to remove the device from HA, but if you don't disable discovery on tasmota, it will be rediscovered. Since
Thanks Norbert. I use benzino77/tasmocompiler to produce the custom firmware, I have to check how to configure it to use dev branch. |
Beta Was this translation helpful? Give feedback.
-
yes, I already made sure to pick a different sensor name (
my bad, thanks for the explanation.
Right now stable is |
Beta Was this translation helpful? Give feedback.
-
I finally managed to add the Hydrolysis Runtime entities, I converted the format and created MQTT Sensors with device_class: duration. The format is h:m:s. Updated files on the repo. I also found out a major problem for the MQTT switch entities (and possibly, all modifiable/actionable MQTT entities, well described in HA documentation: This is the configuration of a MQTT Switch: switch:
- unique_id: "neopool_mqtt_light"
name: "NeoPool MQTT Light"
device_class: switch
command_topic: "cmnd/SmartPool/NPLight"
state_topic: "tele/SmartPool/SENSOR"
retain: true
optimistic: false
value_template: >-
{{ value_json.NeoPool.Light }}
payload_on: 1
payload_off: 0
state_on: 1
state_off: 0
availability_topic: "tele/SmartPool/LWT"
payload_available: "Online"
payload_not_available: "Offline" When you start HA, or reload the config, these entities are reinitialized. I'm using One solution (cleanest one) is to use If you have any suggestion regarding this last main issue, I'd be very happy to hear it. Thanks, Alessandro |
Beta Was this translation helpful? Give feedback.
-
New UI: hope you like it. |
Beta Was this translation helpful? Give feedback.
-
Hi Norbert/@curzon01, since you're the NeoPool driver's dev, I have a question: in Home Assistant I see all the sensors related to the driver, but I see no "controls" (that is, the switches that toggle relays, filtration, etc.). My friend, @CosminFRC, told me that with ESP82xx device, he sees those controls in HA. I'm not convinced it depends on the cpu type, but maybe the driver is different between the two so also the Home Assistant integration leads to different results? Or it could depend on the fact that on the ESP32 we use Berry scripts vs fake GPIO relays on the ESP82xx?
This is what I see with M5 Atom in Home Assistant:
And he showed me what he sees with ESP82xx device (he has Controls section in addition to the Sensors):
Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions