Welcome, Guest

Author Topic: Blockly examples scripts, upload a picture of your script to help other users  (Read 7726 times)

bjacobse

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 301
Upload your blockly code, as a picture, and a little eksplanation - I hope this will help other happy Agocontroler-users to use it even more :-)

Blockly can be found similar like this: replace x with your own ip address
http://x.x.x.x:8008/?pluginDashboard&name=agoblockly

Every Monday 01.37 I send an email, with temperature + distance measurement to my own email address (Yes thanks yo Tang I got this working from his good example)

Kezza

  • Newbie
  • *
  • Posts: 16
I've had the attached setup (excluding the day criteria) so that every night our irrigation starts up 1 valve for an hour and then a 2nd one for an hour.

We now have restrictions in place which means we can only have it running on odd days of the month, what I need is for the day criteria to be able to check if it is an odd day (or number in a list). I cannot work out how to set it up (presuming possible) with blocky.

Any help would be appreciated.

bjacobse

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 301
Checking for odd day - Will this work?

Kezza

  • Newbie
  • *
  • Posts: 16
Checking for odd day - Will this work?
Thanks, I had seen 'is odd' but couldn't work out how to use it. Will do some testing tonight and see if it works.

bjacobse

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 301

Kezza

  • Newbie
  • *
  • Posts: 16
Working example which on odd number days of the month at 7pm turns on a switch for an hour then switches it off and turns another one on for another hour.


bjacobse

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 301
Glad you have posted your working example with the odd day - hope this will benefit other users too

hari

  • Administrator
  • Hero Member
  • *****
  • Posts: 610
Wiki content is always appreciated, if you guys want to do some tutorials :-)

Kezza

  • Newbie
  • *
  • Posts: 16
What would I need to check to respond to agocontrol startup?

Looking to trigger an email and check devices are set to off when system restarts after power cut etc.

bjacobse

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 301
What would I need to check to respond to agocontrol startup?

Looking to trigger an email and check devices are set to off when system restarts after power cut etc.

Hi Kezza,
I don't understand your question, can you rephrase or explain more details?

jsimonetti

  • Global Moderator
  • Newbie
  • *****
  • Posts: 35
Hi Kezza,

AFAIK there currently is no event that indicates startup. This sounds like a good addition though. I will add it to the feature list.

knobby

  • Newbie
  • *
  • Posts: 6
Does anyone have an example for a motion sensor to turn on a light when motion is detected and then turn it off when it is no longer detected? I've been trying to get this to work and so far I haven't figured it out.

Also, how do people go about debugging their scripts? I've tried adding print blocks, but I can't find where they output. I've turned on event draining on the web page, looked in /var/log/messages and /var/log/syslog and I don't see anything related to my scripts. I thought I had this working, but then suddenly it doesn't appear to be working. I'm wondering if it is the logic I put in to only turn the light on if it is off, but I am having trouble debugging this.
« Last Edit: April 06, 2015, 04:22:57 am by knobby »

Kezza

  • Newbie
  • *
  • Posts: 16
Does anyone have an example for a motion sensor to turn on a light when motion is detected and then turn it off when it is no longer detected? I've been trying to get this to work and so far I haven't figured it out.

Also, how do people go about debugging their scripts? I've tried adding print blocks, but I can't find where they output. I've turned on event draining on the web page, looked in /var/log/messages and /var/log/syslog and I don't see anything related to my scripts. I thought I had this working, but then suddenly it doesn't appear to be working. I'm wondering if it is the logic I put in to only turn the light on if it is off, but I am having trouble debugging this.

I think attached pic should do it, untested so if you have issues let me know.

I don't have a motion sensor at the moment but configure the green part to map to your sensor, state being 255 = motion detected.

This is something I need asap so might try and get working tonight and will post if anything wrong in screenshot.

MarcoZan

  • Newbie
  • *
  • Posts: 25
Surely someone might have found a better solution, but I thought it could be useful anyway to share ...

This is how I'm using blockly to turn on a light when a specific motion sensor is triggered.
This code is currently working on my environment, and is taking care only to switch on the light. There is another python code in charge to switch it off after some delay.

Hope it helps

Regards
Marco