Quantcast

Any Raspberry Pi/Python coding nerds?

Westy

the teste
Nov 22, 2002
54,474
20,272
Sleazattle
If you have some basic coding background just ask ChatGPT to generate some code for you. It probably will not work right off the bat but the syntax will be correct and you will just have to debug a bit.
 

gonefirefightin

free wieners
If you have some basic coding background just ask ChatGPT to generate some code for you. It probably will not work right off the bat but the syntax will be correct and you will just have to debug a bit.
My coding background is severely dated and minuscule, introductory MS DOS is about my extent. Seem Raspberry pi themselves have some pretty decent intro courses I am thumbing through at the moment. Have yet to jump on the Chatgpt bandwagon but it seems it is inevitable at this stage in the game.
 

Westy

the teste
Nov 22, 2002
54,474
20,272
Sleazattle
My coding background is severely dated and minuscule, introductory MS DOS is about my extent. Seem Raspberry pi themselves have some pretty decent intro courses I am thumbing through at the moment. Have yet to jump on the Chatgpt bandwagon but it seems it is inevitable at this stage in the game.
Beyond coding you kind of have to have some Linux knowledge to set things up which I found to be a royal pain in the ass.
 

canadmos

Cake Tease
May 29, 2011
20,546
19,572
Canaderp
Like Westy said, chatgpt or whatever is the way to go. You'll spend less time banging your head off the wall because of a misplaced quote or missing semi colon and more time getting results.

But, it will REALLY help if you can tell it exactly what to do. Like encourage it to use a certain function or method, rather than letting it decide that (though sometimes thats fun too).

I do this with powershell now. I can write working scripts in a fraction of the time, compared to writing them out by hand. But I've learned you have to break it down into sections, it won't be able to do anything very complicated - it just confused and will say that output works, whether that is reality or not. So similar to writing it all out yourself, its good to know what the end result is and have a general idea of how to get there.

I'd sign up for a class that goes through the basics of python (and code in general) and then one that has labs that helps speed things up, so you aren't wasting time on trying to get stuff to work on random hardware - just start writing code.
 

canadmos

Cake Tease
May 29, 2011
20,546
19,572
Canaderp
Taking a BASH scripting class will also help with the system side.


But be prepared to throw your keyboard at the nearest window.
 

gonefirefightin

free wieners
Like Westy said, chatgpt or whatever is the way to go. You'll spend less time banging your head off the wall because of a misplaced quote or missing semi colon and more time getting results.

But, it will REALLY help if you can tell it exactly what to do. Like encourage it to use a certain function or method, rather than letting it decide that (though sometimes thats fun too).

I do this with powershell now. I can write working scripts in a fraction of the time, compared to writing them out by hand. But I've learned you have to break it down into sections, it won't be able to do anything very complicated - it just confused and will say that output works, whether that is reality or not. So similar to writing it all out yourself, its good to know what the end result is and have a general idea of how to get there.

I'd sign up for a class that goes through the basics of python (and code in general) and then one that has labs that helps speed things up, so you aren't wasting time on trying to get stuff to work on random hardware - just start writing code.
I am finding this out,

But on the same hand I feel like I can benefit from at least the basics before asking skynet to do it for me so I can at least troubleshoot or modify some crowdsourced lines of code to bend it to my will.

Most of the stuff I will be doing is pretty light in terms of an actual code writer and will be revolving around Dali protocols and a broad lasso to grab the native strings that the current smart home UI is running from such as Alexa/google home, siri, home assistant, Hue and zwave.

I found some good groups on Facebook and in the Raspberry pi groups that has gotten me on the right path and even some very helpful strings that are copy and paste for my needs.

This is about the extent that I will be using it all for

#!/usr/bin/python2.7
# send DALI Level from Console

import time
import serial
import sys

ser = serial.Serial(
port ='/dev/ttyS0',
baudrate = 19200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1,
)

text = input("Which DALI address ( 0-63, 127=All) : ")
address = int(text)*2
input = 254
ser.read(100)
y1 = 0
y3 = 0

while input < 255 :

text = raw_input(" What level : ")
if text == "q":
exit()
if text == "":
input = input+1
print('set level : %d'%input)
else:
input = int(text,10)

ser.write('h%02X%02X\n'%(address,input))

The other more intricate stuff will be leaning pretty heavy on chat GPT for, since it will be very specific for items such as well pumps, hydronic controls and even other automations such as leak detectors to automatic valve shut offs
 
Last edited:

canadmos

Cake Tease
May 29, 2011
20,546
19,572
Canaderp
Another thing to keep in mind is having some redundancy or fail safes, for anything that might cost you $$$ or something if one of your components fails (floods, water damage etc).

Things like getting a notification if something fails or stops responding can be key. Think up the chain too; if your pump stops working because the power is out, is your raspberry pi the thing sending a notification? Will it have power to do so? Will the interwebs work if the power is out? What if aliens land and probe your network?

And package updates in linux could break your stuff at any given moment, so tread with caution and test. :brows:
 

gonefirefightin

free wieners
Another thing to keep in mind is having some redundancy or fail safes, for anything that might cost you $$$ or something if one of your components fails (floods, water damage etc).

Things like getting a notification if something fails or stops responding can be key. Think up the chain too; if your pump stops working because the power is out, is your raspberry pi the thing sending a notification? Will it have power to do so? Will the interwebs work if the power is out? What if aliens land and probe your network?

And package updates in linux could break your stuff at any given moment, so tread with caution and test. :brows:
10 steps ahead of ya, I like where your heads at

The redundancy will be disgustingly overboard. Being off grid with solar and battery the LAN and starlink will always be available with a cellular backup if storm blockage occurs. The Raspberry pi's will effectively be a standalone monitoring and controlling device for specific "parts" or areas of interest of the property.


Being able to stack Pi's in a server rack and have stand alone boards for each specific task such as one for low voltage, one for plumbing, one for solar etc will give me a bound set and still be stand alone for each system as well as have some overlap. with the advent of LAN operated solenoid valves, wifi breakers and even smart relays I will be able to have complete control via my phone if I am in another state working on another project.