Do you have a parts list for this? I’d love to control my kessil lights!!
You need an MCP4725
And an LM358
Need one of each per channel.
Not sure that I would go this route vs trying PWM approach or a different board like the one cowboy mentioned.
I’m the kind of guy who could figure it out if he has a step by step dummy guide. I need to get a list of everything required from the ground up and then how to wire it as you have.
the ability to control my 2 chan 0-10v kessil lights would be absolute amazing.
Do you have a file literally called: /home/pi/temp1_F ?? If so, you probably need to do a “chmod 750 /home/pi/temp1_F” so that file is executable and can be run.
You also can/should put the contents of your script in that file - the script that retrives the temperature measurement data. Then mosquitto_pub will be able to execute the script and take the returned output from that script as it’s own input (the temp data) and set that to Home Assistant.
Well then welcome out of the lurking stage and into the active participation stage.
You could pick up some cheap doser pumps and hook them up to relays and DA converters to control them from your RaspberryPi. Then run airline several meters to your tank and in-between your dorm room sink (if you have one) as an auto-water change system.
You could also create a GPIO button next to the aquarium to control things like turning pumps off for feeding (or even cycling them during feeding to keep food suspended / animate). You could even add a couple of buttons for your lights or a dial to make graduated lighting adjustments or spectrum changes.
You could also add a day / night temp function to your heater control.
In addition to a heater control, create a seperate temp alarm function. Just in-case your temp function breaks or relay AND heater-thermostat both stick in unsafe positions. And sometimes, over heated tanks may not be the result of a heater problem, but other factors.
You could even add a float sensor alarm. If someone in your dorm room decides your fish need some beer and pours a can in (if you don’t have numbskull friends in University like I did, count your blessings), the float sensor could immediately let you know water just increased a bit beyond normal levels = something’s wrong.
Security alarm for your aquarium top? Hmmm…
Writing up a basic introductory HOWTO is on my ToDo list. I’m facing some immediate customer work in front of me at the moment, so I can’t say when I’ll get to it, but below are a few links to get you started with a couple of the sensor types: float sensors (work just like a button) and digital temp sensors:
DS18B20 (Waterproof and non water proof versions) Temp sensors
Float Sensors and Buttons:
BTW, the hackstar.io article above mentions just using a single 100K resister, but I believe using 2 resisters as explained in the Understanding Computers: GPIO Youtube video, is a better, safer approach concerning your hardware investment. Especially if you’re going to be hacking on your own design a while.
That’ll be the first step is getting your hardware input sensors set up and working and tested. Once you have that, the next step is getting their output into Home Assistant.
oh, I have no issues with setting up some diy sensor stuff with home assistant. dht22, pir and float are all a breeze with espeasy and nodemcu.
whats new for me would be the 0-10v control for my lights!
the file is named temp1_F.py it is a python script very similar to what you posted a while ago. I ran chmod 750 and when I type ls the file is a different color now. However when I use the mosquitto_pub it still just publishes /home/pi/temp1_F.
I’m not sure what you mean by the second part unfortunately. I feel like I should be putting the mosquitto data somewhere in the script, but anything I’ve googled isn’t making sense for me to get working.
May have gotten in over my head on this one…
I had to look back through your previous posts, but think I see your problem now…and relax, you’re not in over your head, you’re just missing some tiny small characers from your command.
If I understand right, this is still the following command you are using to run your script and publish the result… right? I see your error now.
mosquitto_pub -u USER -P “PASSWORD” -t homeassistant/sensor/fishroom/temp_F -m “/home/pi/temp1_F" -h HA IP address
Try this following variation on your line above and see if this works on sending your Temp data correctly.
mosquitto_pub -u USER -P “PASSWORD” -t homeassistant/sensor/fishroom/temp_F -m “`/home/pi/temp1_F`” -h HA IP address
Do you see the difference I made above in the second version? I embeded 2 x " ` " characters inside the double quotes around the file path and name of your script.
Just like in Mathematics … where (1+2) X 42 the parenthesis around 1+2 say tell you to Add 1+2 first, before multiplying… those " ` " bracketted around your “command” tells your script to execute what’s in those single slanted apostrophes first, and then the rest of the command line.
The problem you are having now, is your python interpreter looks at the whole line and doesn’t understand it shouldn’t be publishing the filename and path, but should be executing that first instead. Making the changes as I have provided in the second example above, should fix your problem.
Good luck & let me know how it goes. You are ALMOST there.
I just learned something as I made his follow up post to you.
It seems the Web interface to the forum here will sometimes strip out certain characters and that " ` " apostrophe is one of those. It would show as I typed it in the Authoring window, but I just now realized it wasn’t showing up in the actual post nor in the preview pane on the right of the Authoring Post window.
Hence, not knowing this, in my previous posts this important character was being stripped out of my posts and was subtle enough I didn’t notice it till now.
Sorry for the headaches Ciwyn and to anyone else. But also check when you’re sharing your own code that all the characters actually show up in the preview window. Otherwise this could get more frustrating to debug stuff than it needs to be.
I haven’t built the 0-10v control just yet, and probably won’t look to implement it until I get back from a biz trip that’s just around the corner in a few weeks.
There’s some low pass filter methods using a Resistor circuit I’d considered in the past, but I’ll probably go via an 8 channel DAC route, which will probably just tie into my Pi over an SPI link. This will give me a great deal of control over the speed ranges in between 30% and 100%.
I’m just looking for the 2-3 week hole in my schedule I can sit down, hack together the hardware & software, and then wire it all up to my pumps and Pi that’s already near my display tanks. And I know as soon as I get this I’m going to want to sit down and create all sorts of wave patterns I never could before with the standard Tunze stream pump controllers.
I will try to document everything as I go along tho, better than I have in the past, once I find that point in time.
So I switched the mosquitto line to “’/home/pi/temp1_F’” and of course what happens is home assistant shows the state as ‘/home/pi/temp1_F’. I even eliminated the " and just put ’ around it and it returned /home/pi/temp1_F.
So I’m thinking somewhere I am having issues getting mosquitto to run the script.
Nope… do not use the Single Quote character that you find on the same key as your Double Quote character.
This does not have the same meaning in UNIX Scripts that the Apostrophe has. The Apostrophe Character I’m referring too is usually found on most keyboards on the left hand side of the keyboard near the Tilde " ~ " character.
Double Quotes: "
Single Quotes: ’
Apostrophe: `
See the difference? Which were you using in your script? I suspect the Single quotes and not the Apostrophe character. Because the Quotes would in effect tell your script internally “do not interpret this / execute it, just use it like this.”
Embedding the Apostrophes inside the Double Quotes tells the script interpreter to use “everything inside the Double quotes” and then the apostrophes inside the Double Quotes tell the interpreter to evaluate / execute everything inside the Apostrophes
.
But using the Single Quotes inside the Double Quotes tell it script interpreter to use everything in the single quotes exactly as it is… which is what is being sent to HA over MQTT and is showing up in your HA Dashboard.
So just change the single Quote characters inside your double quotes into Apostrophes and try again.
And don’t worry… every newbie who starts writing shell scripts always gets a little confused by this in the beginning. But don’t get frustrated with it. Stay patient. Knowing how to work with Linux/Unix is a skill that you’ll always be able to draw on in the future. Because Linux run’s the world.
Yes that was definitely the error I was making. Now on to the next issue. When I try and run the mosquitto_sub with all the correct commands it keeps spitting back: permission denied.
Upon googling that I have come up with several chmod +x and other permission changing commands to run, but I can’t get it to change.
Ahhh… I read your next issue incorrectly. Just removed that answer.
Is the mosquitto_sub command properly set with the right permissions?
Can you change to the dir it’s located in and do a “ls -l mosquitto_sub” and see what they are set too?
I can’t find a mosquitto_sub file anywhere…
Did you install Mosquitto on your system? It may not be installed.
Try whereis mosquitto_sub
It is installed (it was a process to install on stretch actually). whereis was a big help, thanks Keith
ok when I type ls -l mosquitto_sub I get: -rwxr-xr-x l root staff 40372 Jan 6 00:56
I suppose you don’t get permission errors anymore or do you?