Page 1 of 1

Anybody have experience building custom components/switches?

Posted: Fri Apr 29, 2022 1:10 am
by HydroRay
I'm struggling big time trying to get the Atlas Scientific EZO Peristaltic pumps to work in Home Assistant/ESPHome because the EZO circuits are only set up to be sensors and not switches. Scouring these forums I see people have talked about the pumps but I couldn't find a resolution anywhere.

I'm thinking a custom switch needs to be made in ESPHome but I've been studying the instructions from ESPHome and trying all day to write a code that works with no luck...

All that I believe is needed is a custom switch component that can operate from an i2c address. From there it should populate as an entity you can turn on and off, and then create the automation from there with ease. Does anyone know how to do this? It involves creating a C++ file and then referencing that file in the ESPHome config yaml for the device you're wanting to use it.

Thank you Thank you Thank you!!

Re: Anybody have experience building custom components/switches?

Posted: Sun May 08, 2022 12:21 am
by mikeyB
Can you wire the pump to a sonoff switch? I like the 4ch pro, it gives you a little room to add more later on if need be.

Flash it with tasmota then you can add that to home assistant

Learn node red as well it’ll help your end game

Re: Anybody have experience building custom components/switches?

Posted: Mon May 09, 2022 10:53 pm
by stud
just send the commands to your EZO-PMP via mqtt on HA , to Tasmota
example here : https://github.com/arendst/Tasmota/issues/11891

Re: Anybody have experience building custom components/switches?

Posted: Sat May 14, 2022 7:11 pm
by HydroRay
stud wrote:
Mon May 09, 2022 10:53 pm
just send the commands to your EZO-PMP via mqtt on HA , to Tasmota
example here : https://github.com/arendst/Tasmota/issues/11891
I really don't want to go through Tasmota because
- there's no way to control how often the sensors take readings, it's 1/sec no matter what. I don't want to overwork the device if I don't have to
- there's not a clear temperature compensation formula like ESPHome. Granted, from what I can tell the pH is accurate but the EC is not
- I still haven't figured out mqtt :cry: (but the link you sent stud looks like it would fix my issues, thanks!)

I like having the sensors in ESPHome (I even figured out the calibration which is pretty easy once you give it a try) and unfortunately there's no way to run both tasmota and esphome at the same time.
mikeyB wrote:
Sun May 08, 2022 12:21 am
Can you wire the pump to a sonoff switch? I like the 4ch pro, it gives you a little room to add more later on if need be.
I don't believe the issue is getting power to the pumps, it's sending the command to the pumps. I've got a couple tp-link smart plugs that are very helpful though. If I end up needing more I'll probably pick up the sonoff switch on your suggestion :)

I actually got really close (I think) going off a thread I found here involving ssieb and his custom components https://github.com/ssieb/custom_components (it was for ezo sensors but they have since been removed due to integration). He has an "i2c_button" component that responded when I set it up to one of the pumps. Unfortunately it just spams "Button B long clicked" because it was created for when physical buttons were pushed.

If I had more coding knowledge I could change the code so it allowed the component to turn something on instead of read data, and I'm pretty sure it needs to be modified in the .cpp file, but it's over my head :?