posted v 7.9.10
fixed "key error mrk1000"
now on plugin store w link to GitHub for plugin source
Karl
import time
indigo.device.statusRequest(552277016) #DHT-22 Temperature
indigo.device.statusRequest(1982059710) #DHT-22 Humidity
time.sleep(1)
tempDev = indigo.devices[552277016].states["sensorValue"] # "055 - Sensor 1"
humidDev = indigo.devices[1982059710].states["sensorValue"] # "055 - Sensor2"
Fahrenheit = round((tempDev * 1.8) + 32,1)
indigo.variable.updateValue(85670234, value=unicode(Fahrenheit))
tempSensor = indigo.variables[85670234]
if tempSensor > 0:
sensorLog = "OK"
indigo.server.log("Updated varibale tempVar to "+str(tempDev) +" ºC - " + str(round(Fahrenheit,1)) + " ºF - "+sensorLog+" - Humidity - "+str(humidDev)+"%")
plug = indigo.server.getPlugin("com.karlwachs.arduino")
plug.executeAction("setPins" , #send temp value to IndigoArduino script
props ={
"CMD":"analogWrite"
,"Pin" :"D3"
,"aValue": tempDev # DHT-22 temp value
,"device": "Arduino Test"} # indigo device name
)
dded features / changes in v2022.9.16 @ 2023-08-03
===================================================
1. added in parse from arduino:
- response from arduino; b’>>rd:S1=xxx&rd:S2=xxx& … &S7=xxx’ in python3
- remove b (byte indicator)
- remove >> at beginning of string
- use last 2 char for command id as all cmds are only 2 char long.
2. reduced the error log dump when connection to arduino fails.
Users browsing this forum: No registered users and 0 guests