Thoughts to adding a GPIO header ON/OFF for a heater #2272
Replies: 43 comments 62 replies
-
@Alex-developer Alex, isn't there a module that helps with this? |
Beta Was this translation helpful? Give feedback.
-
I’ve done this myself using python, fully automatic heating and cooling. I’m not great at coding but happy to share what I’ve done so far so it could (if acceptable) be added to the allsky package? My way is simply a script that measure internal and external temperatures, works out if too cool or too warm and switches a heater or fans on. It runs as a service. |
Beta Was this translation helpful? Give feedback.
-
Anything that can be accessed and turned on/off by the Web interface would be excellent. I have read some commands that could do it from the command line. |
Beta Was this translation helpful? Give feedback.
-
Once you've installed your relay libraries (if using a relay hat like I do) then the code for manually switching on in Python is this:
to switch off it's this:
I was going to learn how to control this via a webpage button like you say, but didn't get round to it. |
Beta Was this translation helpful? Give feedback.
-
@Jonk2 |
Beta Was this translation helpful? Give feedback.
-
So I am looking at some of the basic stuff to program the Pi in Python. I am assuming these commands will not mess with the All sky Programming.
looks like this is just things to enable the GPIO in the OS?? |
Beta Was this translation helpful? Give feedback.
-
@Jonk2
Thought this would turn the pin on (High) but does nothing. saved as heat_ON.py |
Beta Was this translation helpful? Give feedback.
-
I know nothing about programming in Python or PHP both of which I guess you need to know to make this work. So I have my code working. Two different programs to turn on/off the relay. OFF
ON
They work fine, but I think I need something to pass the current state to some parameter like (Heater =X) I'll assume that this needs to be binary 0=Off 1=On. I guess it could be a text value as well. My Task list.
Am I kind of on track here? |
Beta Was this translation helpful? Give feedback.
-
Figured out how to get 2 buttons on the systems page. |
Beta Was this translation helpful? Give feedback.
-
OK Now lost. which line is the actual command to run the on/off program I have made in python?
|
Beta Was this translation helpful? Give feedback.
-
folder is in the root called dew-heater
I want the buttons red and green I also am trying to learn how to have a variable so I can post the status (ON/OFF) on the page Im getting there.
so I can play with out damaging anything. |
Beta Was this translation helpful? Give feedback.
-
All righty..... I got them colored. No idea why the question mark. |
Beta Was this translation helpful? Give feedback.
-
@BobW55 Bob,
Go to the "System" page in the WebUI and press the "Heater ON" and "Heater OFF" buttons. The advantage of using WEBUI_DATA_FILES over what you're currently using is that your setting will be preserved when you upgrade, and you don't need to change any Allsky code (which will be overwritten when you upgrade). |
Beta Was this translation helpful? Give feedback.
-
now getting:
I have tried the sudo -s option as well |
Beta Was this translation helpful? Give feedback.
-
@BobW55 The possibilities are only limited by your imagination! Creating the "extra" file is really easy: just have your scripts write "VARIABLE=VALUE" to the file, e.g., I think the warning messages are pretty good and combined with the updated "Troubleshooting" section of the WEBUI_DATA_FILES documentation, it's pretty clear how to fix the problem. |
Beta Was this translation helpful? Give feedback.
-
Ok working on the overlays. dewheater_overlay.json
|
Beta Was this translation helpful? Give feedback.
-
WEB_UI_OVEARLAY="home/pi/overlay/userfile.txt" <-------- all user variables go here It would just make it easier to look in one place for user added variables. be it a txt or json type file. |
Beta Was this translation helpful? Give feedback.
-
Fixed the json file (turned green) but allsky overlay is not picking up the data in it. stopped/started allsky did not help. does it need a reboot? |
Beta Was this translation helpful? Give feedback.
-
Reboots rarely fix anything with Allsky software. Restarting Allsky does sometimes. Best bet is to look in |
Beta Was this translation helpful? Give feedback.
-
I have a simple json file dewheater_overlay.json
The overlay editor does not pick up the file or it contents. |
Beta Was this translation helpful? Give feedback.
-
That's a great idea! Adding a simple ON/OFF toggle in the allsky settings Tab of the WEB user interface would make it much easier for users to control the GPIO pins for a heater. It would also be nice to allow users to customize what they hook up to these pins, depending on their specific needs. |
Beta Was this translation helpful? Give feedback.
-
@EricClaeys |
Beta Was this translation helpful? Give feedback.
-
Found this confusing. you want the data file for overlay in the /allsky/tmp/extra/XXX folder. Yet you also state that on a reboot this directory is rebuilt. would this not wipe out the users data file?
|
Beta Was this translation helpful? Give feedback.
-
Right now that is where I store a file for the status of the dewheater. since this maynot be updated for weeks to months. |
Beta Was this translation helpful? Give feedback.
-
Bob, the Modular Manager has different events that tell it when to run a module:
These are the items in the drop-down. As you noticed, the "Allsky Script" module isn't in the Periodic list - Alex will need to fix that. You can then specify how often it runs. This may be a situation we didn't consider, i.e., data files that don't change often so should remain in the "extra" directory all the time. @Alex-developer, thoughts? |
Beta Was this translation helpful? Give feedback.
-
Ok, solved the problem with the status of the dew heater on the overlay. |
Beta Was this translation helpful? Give feedback.
-
@BobW55 Bob, |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Following, going to try and rig something like this up as well |
Beta Was this translation helpful? Give feedback.
-
I see several people have added code to control a GPIO pins for a heater.
Any thoughts given to adding in a set that can be toggled ON/OFF in the allsky settings Tab of the WEB user interface.
Dont need all the temperature/ humidity relaited stuff. Just a simple on or off and what ever the user wants to hook to them.
Beta Was this translation helpful? Give feedback.
All reactions