1-Wire commands

Posted on
Tue Nov 21, 2023 8:10 am
pacman offline
Posts: 67
Joined: Sep 17, 2008
Location: Pacifica, CA

1-Wire commands

Current Indigo version is 2021.2

I have resisted upgrading to the newest version (tried once before) because of script errors. My initial solution was to convert scripts that used conditional statements to Indigo triggering events. No small task as I have used scripts all through my solution to change Variable values, initiate Action Groups and the like. Most of the conversion to triggers has been successful but a few questions remain:
1) performing math calculations for Variables: time, date, temperature and Sonos volume changes, to name a few.
2) push commands to 1-Wire DSP7X4 Digital Displays (3 installed)

Code: Select all
   # Display2 Temp 1
   myVar1 = indigo.variables[105984720].value
   myVar2 = myVar1 + "^F"
   myVar3 = '"'
   myVar4 = myVar3 + myVar2 + myVar3

   myURL = str("http://192.168.0.40/1Wire/SetDisplay.html?Address_Message_Array={7900000022A73012," + myVar4 + "}")

   import urllib
   urllib.urlopen(myURL)

3) push commands to D2 - 2 Channel Digital I/O 1-Wire Card

Code: Select all
   # Turn ON D2_1_A
   myURL = str("http://192.168.0.43/devices.htm?rom=CA000000D6679612&variable=FlipFlop_A&value=0")

   import urllib
   urllib.urlopen(myURL)

I can test my displays by paste and go url commands using my browser. What are my options for sending URL commands within Indigo? The above script(s) work well.

Until I actually upgrade to latest version I want to understand how my scripts are affected. I just replaced all my Insteon devices with z-wave at no small expense. Some of the z-wave devices I purchased won't include with current version. The promise of making the conversion is a greater range of z-wave products available. Then there is the plug-in upgrades!

I probably won't be expanding my HA solution for my home but I do want some more stability with what is currently installed. I do look through the Indigo Forum for help but find the volume of data daunting. Thanks Matt for pointing be to this thread.

Thanks for any comments or suggestions. I will spend time going through this thread for a better understanding of what an upgrade my entail.

Posted on
Tue Nov 21, 2023 8:53 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: 1-Wire commands

Is there an actual question for #1? Doing math in Python is straightforward. Getting the variable value and updating a variable is well documented.

Don't use str() on objects that are already strings. It won't break things, but it's not needed.

Don't use addition (plus signs) to assemble strings. Use fstrings. https://stackabuse.com/string-formattin ... f-strings/

Assuming that your example is supposed to generate something like this:
Code: Select all
http://192.168.0.40/1Wire/SetDisplay.html?Address_Message_Array={7900000022A73012,"101"}

Then this works:
Code: Select all
myVar1 = indigo.variables[105984720].value
myURL = f'http://192.168.0.40/1Wire/SetDisplay.html?Address_Message_Array={{7900000022A73012,"{myVar1}"}}'


Don't use urllib. It's been replaced by the "requests" library, which is much easier to use. See https://requests.readthedocs.io/en/latest/

Code: Select all
# Turn ON D2_1_A
import requests
myURL = "http://192.168.0.43/devices.htm?rom=CA000000D6679612&variable=FlipFlop_A&value=0"
r = requests.get(myURL)
if r.status_code != 200:
    ERROR!


joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests