Sorry if this has been answered but have looked through all and either have missed it or just too old, lol.
I have built a sensor using temp/humidty and microcontroler to provide serical interface. Used the generica serial module and defined "t" and "h" as commands. All works well, I get the expected results. I then created 2 null devices to hold the value of the received data commands and created 2 task based on timers to update the null devices. The problem is, when the temp null device updates, the humidity null device updates also. The problem also happens to the humidity task runs, both null devices update, even though the task is only set to update the one in "focus".
Thanks in advance for your help. When I get this sorted out, I would like to add a CO2 sensor to the microcontroller to provide more data to HB.
This is all towards automating a small greenhouse using HB and a few Insteon appliance swtiches for now.
MGBDude
Generic serial device question
Re: Generic serial device question
Can you post your task logic?
Osler
Osler
Re: Generic serial device question
Thanks,
The logic is,
If ('Timer.Remaining Time' is Equal "00:00') Then
Change 'Temp.Get temprerature' to 'temp'
Delaying for '2000' mili-seconds
Change 'current temp.Temperature' to %%Temp.Received Data%%
If ('Timer.Remaining Time' is Equal "00:20') Then
Change 'Temp.Get temprerature' to 'humidity'
Delaying for '2000' mili-seconds
Change 'current humidity.humidity' to %%Temp.Received Data%%
Adding or removing the delay doesn't change the outcome, but without it I get more "garbage" readings.
Thanks again
mgbdude
The logic is,
If ('Timer.Remaining Time' is Equal "00:00') Then
Change 'Temp.Get temprerature' to 'temp'
Delaying for '2000' mili-seconds
Change 'current temp.Temperature' to %%Temp.Received Data%%
If ('Timer.Remaining Time' is Equal "00:20') Then
Change 'Temp.Get temprerature' to 'humidity'
Delaying for '2000' mili-seconds
Change 'current humidity.humidity' to %%Temp.Received Data%%
Adding or removing the delay doesn't change the outcome, but without it I get more "garbage" readings.
Thanks again
mgbdude
Re: Generic serial device question
Just a bit of advice...if the microcontroller is the "device", I would make the null device such that it encapsulates all possible parameters of the microcontroller. So create a null device called "GreenHouse Microcontroller" with properties "GHTemperature" and "GHHumidity" (the GH prefix is just so that the properties are grouped together in the property list when you go to add them to the device). Try to have your HouseBot devices recapitulate the actual device. This will become VERY important as you add more devices to HouseBot.
The "Time Remaining" property of sleep timers is a bit flakey, IMO, and is not suitable for executing task-specific actions. Try using the script below. Cut and paste it into Notepad and then save as <your script name>.vbs to C:\Program Files\HouseBot\Config\Scripts:
Create a task such that the logic is as follows:
and set the Action to execute the above script.
When the script executes, it will poll the microcontroller as you want and then reset the sleep timer to run again. The script will execute every time the sleep timer has counted down (i.e., is not running). Hope this helps.
Osler
The "Time Remaining" property of sleep timers is a bit flakey, IMO, and is not suitable for executing task-specific actions. Try using the script below. Cut and paste it into Notepad and then save as <your script name>.vbs to C:\Program Files\HouseBot\Config\Scripts:
Code: Select all
Dim Temperature
Dim Humidity
Call SetPropertyValue("Temp.Get temperature", "temp")
Sleep(2000)
Temperature = GetPropertyValue("Temp.Received Data")
Call SetPropertyValue("temp.Temperature", Temperature)
Call SetPropertyValue("Temp.Get temperature", "humidity")
Sleep(2000)
Humidity = GetPropertyValue("Temp.Received Data")
Call SetPropertyValue("temp.humidity", Humidity)
Call SetPropertyValue("Timer.Running", "Yes")
Code: Select all
If 'Timer.Running' is Equal 'No' Then
When the script executes, it will poll the microcontroller as you want and then reset the sleep timer to run again. The script will execute every time the sleep timer has counted down (i.e., is not running). Hope this helps.
Osler