virgilm / sparkly

Swimming Pool Automation Systen with Raspberry Pi + Home Assistant
MIT License
14 stars 7 forks source link

calibration only for i2c devices? #25

Open docsparks opened 4 years ago

docsparks commented 4 years ago

it looks like the Calibration code is only fitted for i2c device mode, I'm still new to python and GitHub. you've updated segalions atlas code quite a bit. any chances to help me improve calibration for sensors on serialport via USB atlas ezo device? thank you

virgilm commented 4 years ago

My sensors are I2C, I can't even connect them via serial, as I don't have a carrier board. Calibration clearly needs some work. If you want to give it a try, all you need to do is replace the I2C commands with equivalent serial commands, the logic still stands. You can find those here; serial calibration starts at page 19. pH is the trickiest one, my code only does midpoint calibration for now.

docsparks commented 4 years ago

Sorry for the delay. My issue isnt so much the process of calibration, as much as it is creating commands within the python script. I have already used my sensors for a length of time within windows and understand the commands to do different things, my setback here is my lack of python programming context and homeassistants abilities..

I see that the atlas integration already does mostly what I want, if i wanted to for example, change the temperature for the ph probe, id have to send a command including the current water temperature to the atlas ph sensor via the integration.

but the integration only creates a sensor and has the sensor value as its only return to the component.

how would i extend the existing python script to allow the temperature be set?

I imagine (using hassio/homeassistant OS on a rpi) that i cant open access to the usb port thats already in use by the atlas component, from a custom python script? or can i? ill make an attempt at coding this myself today but im still sure that some changes to the origin sensor.py can be fitted to allow input commands, ie set temperature of water.

any help is appreciated, thanks!

virgilm commented 4 years ago

Oh, I understand. I'm quite new to HA too, I don't know of a way to modify a sensor in such a way - maybe there is one. I'm sure we could implement some other HA entity (e.g. check https://developers.home-assistant.io/docs/dev_101_services) to perform some output functions. The sample code here has an example of python with UART mode.

docsparks commented 4 years ago

After spending the day yesterday attempting to learn what I could, this is where i got..

segalion had originally started trying to make the code allow parameters for settings, via service. Found in https://github.com/segalion/raspipool/blob/master/custom_components/atlas_scientific/__init__.py

I went through numerous custom components I have, as well as info from https://developers.home-assistant.io/docs/dev_101_services and for the limited time i had yesterday, couldnt get anywhere.

I have yet to fully follow the instructions set out with the custom service docs but I still have yet to see in other custom components how the service code could even interact with the python coding in the sensor.py.

I dont have any knowledge with python but have years of programming experience in .net and some java. I may post on the homeassistant forums.

I hope this helps you make any progress

virgilm commented 4 years ago

Sorry, I'm not going to spend time on this, as I don't even have a way to test this out, but the only way I can think of at least at this point would be to have a separate entity (not the sensor) that could run the calibration. From what I can gather, extending a sensor does not have a way to add a 'calibrate' method to it. You could do something similar to what I did, which is to run a shell script (scripts.yaml), which in turn calls a python routine. Unfortunately, the python scripts in HA are quite useless from my perspective, as no imports are allowed: https://www.home-assistant.io/integrations/python_script/

docsparks commented 4 years ago

Thanks again for your contributions to the original code. It does help. I have linked to your repo in my question on the home assistant forums.

here

danielegger1 commented 2 years ago

Not sure where the best place is to contact you, but this might be ok, have you had any luck at implementing the Ezo Pumps with I2C? Tentacle T3 works without issues? Bit afraid before buying everything Thanks in advance

virgilm commented 2 years ago

T3 works without any issues (but it's a bit expensive for what it is). I have a pump too, but I did not try it out yet. I see no reason for it not to work as expected. I have a bunch of code written for this project, I will push it when I get a chance... way too many things to do, and my pump is an industrial 240V one right now. It should be a matter of just adding to the custom component and adding a switch.

danielegger1 commented 2 years ago

Thanks for your fast reply :) i just figured out that going through the wifi kit https://www.robesol.nl/en/wi-fi-pool-kit-bare-bones.html might be the easiest way But I can try Raspipool with that also, just need to manually wire it instead of going through Tentacle. What do you think about that unit? Really looking forward to your updated code, I am always happy that people like you are sharing their hard work for stupid users like me :)