Skip to content

Instantly share code, notes, and snippets.

@xbmcnut
Created May 3, 2020 02:39
Show Gist options
  • Save xbmcnut/299d32f0591d8eef3643af00eb2739fb to your computer and use it in GitHub Desktop.
Save xbmcnut/299d32f0591d8eef3643af00eb2739fb to your computer and use it in GitHub Desktop.
Solar panel pump with differential in/out temperature sensing for pump control
input_number:
### Solar Pump Hysteresis Offsets ##
pump_off_offset:
name: Pump OFF offset
initial: 0.1
min: 0
max: 2
step: 0.1
pump_on_offset:
name: Pump ON offset
initial: 3
min: 0
max: 10
step: 0.5
sensor:
## Water Out Temp ##
- platform: mqtt
state_topic: "/solar/exit/temperature"
name: "Solar Temperature"
qos: 0
unit_of_measurement: "C"
## Water In Temp ##
- platform: mqtt
state_topic: "/solar/Tin/temperature"
name: "Solar Input Temperature"
qos: 0
unit_of_measurement: "C"
# GPIO 12 for PWM Control
- platform: mqtt
state_topic: "/solar/pwm/12"
name: "Solar Motor Value"
qos: 0
- platform: template
sensors:
temp_diff:
friendly_name: Temperature Difference
value_template: >
{% if ((states.sensor.solar_temperature.state | float ) - (states.sensor.pool_temperature.state | float))
< (states.input_number.pump_off_offset.state | float ) %} pump_off
{% elif ((states.sensor.solar_temperature.state | float ) - (states.sensor.pool_temperature.state | float))
> (states.input_number.pump_on_offset.state | float ) %} pump_on
{% else %} pending {% endif %}
switch:
- platform: mqtt
name: "Solar Pump"
state_topic: "/solar/pwm/12"
command_topic: "/solar/pwm/12"
payload_on: "1023"
payload_off: "0"
qos: 1
retain: true
@xbmcnut
Copy link
Author

xbmcnut commented May 3, 2020

That's a bit more difficult to explain. I've got another sensor in there sensor.pool_temperature that is part of the differential template so you'd need that set up too or modify to respect whatever sensors you do have. Easiest way to implement is to use packages. That way you can just drop the whole solar.yaml into your packages folder and it will pick up all the entities.

@pthelm
Copy link

pthelm commented May 3, 2020

Thanks again for the swift reply.
So I set up a packages folder as per Packages in Home Assistant (https://www.home-assistant.io/docs/configuration/packages/). Downloaded your solar.yaml and included packages in my configuration.yaml.
I need to modify my ESPHome DS18B20 temperature sensors to replace your platform: mqtt sensor. However I do not see any of the history graph or status window. Am I missing something. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment