ReefRhythm - Advance Stepper Motor Controller with OpenSource

butch708

New Member
View Badges
Joined
May 15, 2024
Messages
15
Reaction score
4
Location
Germany
Rating - 0%
0   0   0
I'm too stupid to set up mqtt. Maybe it would be a good idea to test the connection to mqtt server in the webgui.?

home-assistant.log
Code:
2024-05-30 19:03:49.658 ERROR (MainThread) [homeassistant.components.automation.start_dosing_pump] Start Dosing Pump: Error executing script. Error for call_service at point of sale 1: Error rendering data template: ValueError: Template error: float got invalid input 'unknown' when rendering template '{
  "id": 1,
  "direction": {% if is_state('input_boolean.dosing_pump_direction', 'on') %}1{% else %}0{% endif %},
  "amount": {{ states('input_number.dosing_pump_amount') | float }},
  "duration": {{ states('input_number.dosing_pump_duration') | float }}
}' but no default was specified
2024-05-30 19:03:49.658 ERROR (MainThread) [homeassistant.components.automation.start_dosing_pump] Error while executing automation automation.start_dosing_pump: Error rendering data template: ValueError: Template error: float got invalid input 'unknown' when rendering template '{
  "id": 1,
  "direction": {% if is_state('input_boolean.dosing_pump_direction', 'on') %}1{% else %}0{% endif %},
  "amount": {{ states('input_number.dosing_pump_amount') | float }},
  "duration": {{ states('input_number.dosing_pump_duration') | float }}
}' but no default was specified
2024-05-30 19:03:51.190 ERROR (MainThread) [homeassistant.components.automation.start_dosing_pump] Start Dosing Pump: Error executing script. Error for call_service at point of sale 1: Error rendering data template: ValueError: Template error: float got invalid input 'unknown' when rendering template '{
  "id": 1,
  "direction": {% if is_state('input_boolean.dosing_pump_direction', 'on') %}1{% else %}0{% endif %},
  "amount": {{ states('input_number.dosing_pump_amount') | float }},
  "duration": {{ states('input_number.dosing_pump_duration') | float }}
}' but no default was specified
2024-05-30 19:03:51.191 ERROR (MainThread) [homeassistant.components.automation.start_dosing_pump] Error while executing automation automation.start_dosing_pump: Error rendering data template: ValueError: Template error: float got invalid input 'unknown' when rendering template '{
  "id": 1,
  "direction": {% if is_state('input_boolean.dosing_pump_direction', 'on') %}1{% else %}0{% endif %},
  "amount": {{ states('input_number.dosing_pump_amount') | float }},
  "duration": {{ states('input_number.dosing_pump_duration') | float }}
}' but no default was specified

automations.yaml

Code:
- id: Start Dosing Pump
  alias: "Start Dosing Pump"
  trigger:
    - platform: event
      event_type: state_changed
      event_data:
        entity_id: input_button.start_dosing_pump
  action:
    - service: mqtt.publish
      data_template:
        topic: "/ReefRhythm/24587cda78dc/dose"
        payload: >
          {
            "id": 1,
            "direction": {% if is_state('input_boolean.dosing_pump_direction', 'on') %}1{% else %}0{% endif %},
            "amount": {{ states('input_number.dosing_pump_amount') | float }},
            "duration": {{ states('input_number.dosing_pump_duration') | float }}
          }
  mode: single

- id: Stop Dosing Pump
  alias: "Stop Dosing Pump"
  trigger:
    - platform: event
      event_type: state_changed
      event_data:
        entity_id: input_button.stop_dosing_pump
  action:
    - service: mqtt.publish
      data_template:
        topic: "/ReefRhythm/24587cda78dc/stop"
        payload: >
          {"id": 1}
  mode: single

If I start one of the pumps in the reefrhythm webgui, it should be displayed in mqtt explorer, right? Unfortunately it won't for me.

I somehow have the feeling that the reff rhythm can't connect with the mqtt brocker. I'm probably making a mistake somewhere.
i have it.



Screenshot 2024-05-30 221853.png


mqtt broker: homeassistant

im stupid, was testing broker adresses: core-mosquitto, core-mosquitto.hass.io and so on. Simply homeassistant :) :)
 

butch708

New Member
View Badges
Joined
May 15, 2024
Messages
15
Reaction score
4
Location
Germany
Rating - 0%
0   0   0
Hello yury,

https://github.com/telenkov88/reefr...me-Assistant-Dosing-Pump-Control-Setup-Manual

Code:
Number for Amount
Navigate to Settings > Devices & Services > Helpers.
Click + Create Helper.
Select Number.
Name it Dosing Pump Remains
Select icon mdi:cup-water
Select display mode input field
Specify a range (e.g., minimum 0, maximum 1000).
Set the unit of measurement to mL.

Code:
- alias: "Start Dosing Pump"
  trigger:
    - platform: event
      event_type: state_changed
      event_data:
        entity_id: input_button.start_dosing_pump
  action:
    - service: mqtt.publish
      data_template:
        topic: "/ReefRhythm/<unique_id>/dose"
        payload: >
          {
            "id": 1,
            "direction": {% if is_state('input_boolean.dosing_pump_direction', 'on') %}1{% else %}0{% endif %},
            "amount": {{ states('input_number.dosing_pump_amount') | float }},
            "duration": {{ states('input_number.dosing_pump_duration') | float }}
          }
  mode: single

there is a a little error that cost me a while :)

you name the helper with dosing_pump_remains but it should be dosing_pump_amount

After changing that, i am able to dose over HA

Have a nice day,
 
Last edited:

butch708

New Member
View Badges
Joined
May 15, 2024
Messages
15
Reaction score
4
Location
Germany
Rating - 0%
0   0   0
Thats the changed code, with ability to switch the pump id by a switch button.
Code:
- id: Start Dosing Pump
  alias: "Start Dosing Pump"
  trigger:
    - platform: event
      event_type: state_changed
      event_data:
        entity_id: input_button.start_dosing_pump
    - platform: state
      entity_id: input_boolean.change_pump
  action:
    - service: mqtt.publish
      data_template:
        topic: "/ReefRhythm/24587cda78dc/dose"
        payload: >
          {
            "id": {% if is_state('input_boolean.change_pump', 'on') %}2{% else %}1{% endif %},
            "direction": {% if is_state('input_boolean.dosing_pump_direction', 'on') %}1{% else %}0{% endif %},
            "amount": {{ states('input_number.dosing_pump_amount') | float(0) }},
            "duration": {{ states('input_number.dosing_pump_duration') | float(0) }}
          }
  mode: single

- id: Stop Dosing Pump
  alias: "Stop Dosing Pump"
  trigger:
    - platform: event
      event_type: state_changed
      event_data:
        entity_id: input_button.stop_dosing_pump
  action:
    - service: mqtt.publish
      data_template:
        topic: "/ReefRhythm/24587cda78dc/stop"
        payload: >
          {"id": {% if is_state('input_boolean.change_pump', 'on') %}2{% else %}1{% endif %},}
  mode: single
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
206
Reaction score
151
Location
indo-pacific
Rating - 0%
0   0   0
Hello Community,

As our project continues to grow and evolve, we strive to make it easier for everyone—users, contributors, and enthusiasts alike—to access, share, and contribute knowledge. With this goal in mind, I've made a significant update to how our project's wiki is managed.

Why the Change?

Previously, the wiki was directly tied to our main project repository. This setup limited the ability to collaboratively edit and improve the wiki without granting broader access than might be necessary or desirable. To foster a more collaborative environment and streamline the contribution process, I have moved the wiki to its own dedicated repository.

Benefits of a Dedicated Wiki Repository:

  • Easier Collaboration: Contributors can now directly edit, fix typos, add content, and refine existing documentation without needing access to the main codebase. This lowers barriers to entry for new contributors and allows for quicker updates and improvements.
  • Enhanced Control and Security: By separating the wiki from the main repository, we maintain better control over who can modify our code versus our documentation. This distinction ensures that contributions can be managed effectively and securely.
  • Focused Contributions: Contributors can focus solely on improving documentation without the overhead of understanding the entire code repository setup. This makes it particularly easy for those who specialize in technical writing or educational content to get involved.
I excited to invite our verified community members to become collaborators on the new wiki repository. Whether you're correcting a typo, adding a new tutorial, or sharing your project setup, your knowledge helps us all. If you're interested in contributing, please reach out to me to get involved.
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
206
Reaction score
151
Location
indo-pacific
Rating - 0%
0   0   0
Cool, i am in, if you let me :)

Welcome, invitation pending.

And actually, if you are playing with HA to use the same "card" for multiple pumps, I just added some useful settings to the to the publication in MQTT:

Screenshot 2024-05-31 151313.png
So topic /ReefRhythm/<unique id>/pump_settings contains settings:
"names" - pump names
"number" - number of pumps
"inversion" - inversion settings for pumps(0= not enabled)
"current" - current settings in mA
{
"current": [ 600, 800,1000, 1200, 1600,1800, 2000, 200, 400 ],
"names": [ "NO3", "PO4", "Ca", "KH", "Mg", "Iron", "Iodide", "Manganese", "Vinegar" ],
"number": 1,
"inversion": [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
}


This is a develop build that can be installed by putting url on OTA page:

Mostly I'm finished working on it and now verifying stability on long run:

- Notification refactoring- separate setting for Telegram/Whatsapp Notifications.
- Extended setting publications for MQTT
- Fixing some known bugs

Screenshot 2024-05-31 151305.png
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
206
Reaction score
151
Location
indo-pacific
Rating - 0%
0   0   0
I'm too stupid to set up mqtt. Maybe it would be a good idea to test the connection to mqtt server in the webgui.?
Yep, possible.

But before I want to make code refactoring. Some people not happy about code quality.
And its reasonable, project becomes too big to leave everything as is.
After refactoring more feature will follow.

And actually I'm going to add DC("Poor Man edition":) ) and "standard" stepper drivers support.
Mostly because I want to play with this tiny GROTHEN peristaltic pumps. Originally they are DC(1.5ml/min rated), but I made mod and install stepper motors:
IMG20240531141449.jpg
 

butch708

New Member
View Badges
Joined
May 15, 2024
Messages
15
Reaction score
4
Location
Germany
Rating - 0%
0   0   0
hello,

It would be cool if we could store the pH value of our liquids in the settings. This would be interesting for later automation and calculations of the dosing quantity.
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
206
Reaction score
151
Location
indo-pacific
Rating - 0%
0   0   0
hello,

It would be cool if we could store the pH value of our liquids in the settings. This would be interesting for later automation and calculations of the dosing quantity.
What transport do you prefer to use to transmit sensor values to the controller?

The easiest solution is to subscribe it to the MQTT topic with a sensor value.
But if you have a MQTT broker, usually you have a server where you can control dosing logic...


Some of this functionality will be added because I have plans to extend the project with PH Controller.
Actually full-assembled custom pcb board for this project is laying next to me right now)
So sensor values will be automatically shared via the ESP-NOW WiFi protocol. But there will be some fail-protection logic, like turning off the pump if the value exceeds PH 8.7.
 

Danchik

Community Member
View Badges
Joined
Jul 17, 2018
Messages
31
Reaction score
1
Location
UA
Rating - 0%
0   0   0
Oh, my bad- its a bug!
Thank you for reporting.
Already fixed in v0.9.5

You can upgrade firmware pushing the "starting upgrade" button on OTA page.
Give it some time like 10min to upgrade and than restart the page
And do not forget to to push "cancel rollback" on OTA page after firmware upgrade.

<hostname>.local will start working again after upgrade.
I just noticed that .local doesn't work through my cell phone, only through my home computer.
I tried it through the Google Chrome browser.

Or is it just me...?
 
Back
Top