Please login or register.

Login with username, password and session length

Author Topic: Weather triggered scripts  (Read 5189 times)

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Weather triggered scripts
« on: February 13, 2019, 10:08:13 AM »

(Works with New UI)
I included these temperature scripts in the PiX10Hub1.1 image however for those that installed HG manually you may not have them.
These are simple wizard scripts and use the data from Open Weather and turn on  or off a light based on a temperature value.
Rename the attached to 1010-Greater_Then_Temperature_trigger.zip,
unzip it, then from the HG Weather and Environment group select import and navigate to the folder containing the HGX files and import.

Open weather I find has more triggering options then Weather Underground as well the API keys are no longer freely being given for WU.
« Last Edit: April 18, 2021, 10:55:39 AM by Tuicemen »
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Weather triggered scripts
« Reply #1 on: February 13, 2019, 10:26:19 AM »

The samples included above are just for temperature greater then and less then.  Users may wish to have different weather conditions triggering different things so Here is a simple walk though to create a weather condition trigger script using the wizard.
1: In HG click on configure then programs then weather and environment.
2: From actions select add new program in the window that pops up enter a name and click OK.
3: Keep the program type set as wizard script and enter a description to help you identify it later.
4: In program code click add command and find what device you wish to turn on or off once selected it will display a number of actions on, off …, select the option then done
5: In trigger code click add condition
6: Click programs then scroll to your desired weather program
7: Scroll down to the item you wish to trigger with
8: Now select greater then less than or equals in the value window type the numerical number only! and then click done.
9: If you wish to trigger using another weather program as well repeat steps 5 to 8
10: Select trigger then the when to trigger.
11: Click actions the save the click back button to exit
12: Be sure the new program (script) you just created is active displaying a check mark on the right side of the screen. If it isn't click the triangle with exclamation mark inside to enable it.

Now every time the weather program refreshes this macro will be checked and run if the condition is met .
« Last Edit: May 16, 2019, 08:24:24 AM by Tuicemen »
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

shtckt

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 26
Re: Weather triggered scripts
« Reply #2 on: February 27, 2020, 12:39:11 PM »

With the recent low temps going far down south, I have attempted to play, from a remote location, using this program to turn on a pool pump to keep it from freezing. Have had mixed results.

Before it turns on from a clock time, and turns off from a dusk setting, I could at least verify the output was on when i set the temperature trigger and saved it. But then i started to question if I had everything set correctly.

I followed the steps you provided. I had used your Buster image posted before the end of the year so some of the first steps were already complete. I verified the program was active so step 12 was already done.

From there on it was a bit confusing to say I was using step 7 or 8 and on thru 10.

From the PROGRAM CODE tab, I entered into a multi-step Wizard where I selected
1. the module what would turn on the interposing relay to energize the pump motor.
2. next selected the 'Control ON'
3. added a Command Argument of 34 (assumed Fahrenheit since I had HG configured for F and not C.
4. Saved settings

Then from the TRIGGER CODE tab, I chose "when condition evaluation switches to 'true' and entered 34 again.

With an ambient temp of 32, I noticed an immediate change to the program's status light to green. I verified from another status screen that the module had turned on.  But then I wondered if the HG program wanted Centigrade because as I saw the Weather Program status had risen above 34 degrees that the module had not turned off. So I went back and entered 1 where i had previously entered 34. After Saving, I noted nothing had changed on the module status. So obviously I have more to play with on this program usage.

I have noticed there are four other options under the TRIGGER CODE tab.
a) when condition evaluation switches to 'true'
b) when condition evaluation switches to 'false'
c) run once, when condition evaluation returns to 'true'
d) when condition evaluation returns to 'true'
e) when condition evaluation returns to 'false'

What does each mean?
 
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Weather triggered scripts
« Reply #3 on: March 01, 2020, 09:20:51 AM »

This program was the prelude to the WeatherAlerter program which you can access from any module in HG (no need to make a wizard script)
In any case I don't  see where you specified the light would turn off. You may need another wizard script to turn the light off.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

shtckt

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 26
Re: Weather triggered scripts
« Reply #4 on: March 01, 2020, 10:01:41 PM »

With your clue, I found within the module the options for not only Remote Control but also Weather Alerter. Have had Weather Alerter on my Dashboard for some time and used its settings for various alarms. Just did not realize it was a module pulldown option.

Since I have a HG timer setting for the pump's X10 module (gives the module a "1" at 9am and a "0" at dusk), I assumed I could use the falling temperature as an overriding trigger to run the pump when it would normally be offline after dusk or before 9am. My assumption includes that the next "0" to "1" or "1" to "0" (be it timer or temperature) would likewise change the status of the X10 module if it respectfully, presently off or on. I want a "1" sent to the X10 module when temp drops just above freezing. It made that argument when I typed "<" and then 36 (since I have a forced Imperial setting in Weather Alerter). If that happens anytime of the day or night that is wonderful. If temperature drops below 36F during the normally scheduled time, nothing changes as a Weather "1" will not overwrite an HG timer "1". If temperature rises above 36F (for a time of say an hour) during the day, what I do not want it to do is turn off the module by overwritting an HG timer "1" with a Weather "0". Since I do not know how the temperature change affects the timed run of the model, I have elected to introduce this temperature only a manual added program change when freezing weather is forecasted and then remove it before it becomes a problem with my module's timer schedule.

It is not a big deal to have this freezing temperature control as I do have an electronic controller outside that directly triggers the interposing relay which gets picked up by the X10 module. Just wanted to have a secondary low temp trigger should that independant device fails. I am using the Weather Alerter to notify me when the temperature goes below 36F. It did so two consequtive mornings last week while we were out of town. I was able to view a CAM and verified water was running over the spillway from spa to pool. But i was ready to request an X10 run if I could not view the water fall via CAM.

In my part of the country, it is rare to see freezing temps much longer than the few hours before dawn. But in 20 years of living here,  I have witnessed 2 times when the temperature was below freezing for two consecutive days. If that happens and the temperature trigger is overwritten by the HG timer dusk "off" trigger, I am...frozen in my tracks...sorry about that.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Weather triggered scripts
« Reply #5 on: March 02, 2020, 08:24:46 AM »

Depending on how the HG scheduler is configured I belive it checks the state of the device during thetime configured and if the state isn't  what it should be it sends the command to change the modules state.
Since WeatheAlerter does a simular check on each update you may have the spa turning on then off during a scheduled off period.
« Last Edit: April 18, 2021, 10:56:16 AM by Tuicemen »
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

shtckt

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 26
Re: Weather triggered scripts
« Reply #6 on: March 06, 2020, 03:40:07 AM »

Tuicemen, good point on the periodic update on the WeatherAlerter from is API that should initiate another temperature triggered module action. I have the program requesting or reading the API hourly. So I feel good that the temperature drop below, or rise above, freezing will cause some action on the X10 module. But can see, as you said, that the temp could turn off a desired schedule run of the pool pump if the temp rises above my setpoint during the day. 

But this is a situation I have had for years with AHP and X10. If I have even a short duration loss of house power, the X10 modules drop out and will require another start request to reestablish a pump run.

In the PLC (programmable logic controller) world, we had to program in a logic that sealed in a request to run that only a request to stop would reset. Flags in the AHP world would be the answer for that path. In the Pi/HG world, I need to research the possibilities to reestablish an HG request to the X10 module if it sees a loss of power from the X10 modem during the normal pump run schedule.
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Weather triggered scripts
« Reply #7 on: March 06, 2020, 06:48:40 AM »

Tuicemen, good point on the periodic update on the WeatherAlerter from is API that should initiate another temperature triggered module action. I have the program requesting or reading the API hourly. So I feel good that the temperature drop below, or rise above, freezing will cause some action on the X10 module. But can see, as you said, that the temp could turn off a desired schedule run of the pool pump if the temp rises above my setpoint during the day. 

But this is a situation I have had for years with AHP and X10. If I have even a short duration loss of house power, the X10 modules drop out and will require another start request to reestablish a pump run.

In the PLC (programmable logic controller) world, we had to program in a logic that sealed in a request to run that only a request to stop would reset. Flags in the AHP world would be the answer for that path. In the Pi/HG world, I need to research the possibilities to reestablish an HG request to the X10 module if it sees a loss of power from the X10 modem during the normal pump run schedule.

Create a Virtual Device and use it as a state flag for your automations. The state of your Virtual Device will determine what conditions your automations will run under. The Virtual Device replicates the flag function in AHP.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Weather triggered scripts
« Reply #8 on: March 06, 2020, 07:46:15 AM »

The fun with flags thread has a program which creates 16 virtual devices (flags). This was created for AHP users that couldn't grasp the virtual device setup.
http://forums.x10.com/index.php?topic=30757.msg180659#msg180659
These are not affected by a power outage however any option a switch has these will have, as well if you name them you can switch them on/off  with Alexa. I still recommend you play with creating a virtual device on your own. The Fun with flags program will just get things setup faster.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.