GreenIQ - Model B - Irrigation and PiBeacon

AndyVirus
Posts: 257
Joined: Tue Mar 18, 2014 11:47 am
Location: Newport Pagnell, UK

Re: GreenIQ - Model B - Irrigation and PiBeacon

Post by AndyVirus »

Model B rev 2.0 - Revision 000e according to cpuinfo


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: GreenIQ - Model B - Irrigation and PiBeacon

Post by kw123 »

so a RPI 1?

the only difference between sending direct gpis commands and sprinkler is that the sprinkler sends several commands
1. switch off all relays
2. switch on the new relay(s)

when you do a single gpio command, just one command is send (switch relay on /off)

it looks as if it takes ~ 8 secs between each of the steps receive, exec setgpio.

will look into it

if could do
top
on the rip and check how busy the RPi is

Karl
AndyVirus
Posts: 257
Joined: Tue Mar 18, 2014 11:47 am
Location: Newport Pagnell, UK

Re: GreenIQ - Model B - Irrigation and PiBeacon

Post by AndyVirus »

According to here its a rev 2 but yes its an old one. https://www.raspberrypi-spy.co.uk/2012/ ... d-version/

Top shows 9-20% cpu most of the time but when i send a sprinkler action it foes as high as 90% cpu.

If it is because its a old board/slow cpu then I can certainly live with an approx 20 second delay. Its only because im reusing the now defunct greeniq that im even entertaining this pi.. all my others are zerow’s or in some cases pi 3. The header board for the GreenIQ is the small gpio header so dont have many upgrade options even if i wanted to swap it out.

If there is an easy optimisation then great but 20 seconds for what is usually scheduled anyway is fine by me now it turns off :-)


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: GreenIQ - Model B - Irrigation and PiBeacon

Post by kw123 »

yes it looks as if the rpi1 is backlogged by the tasks..
there are the following tasks running:
1. ONE receiveCommands
1 execommmands for each command received
1 setGPIO or other commands for each command managed by execCommands

that can be 16 temp processes for 8 relays.

it was setup to:
receive commands as fast as possible, launch a management program (exe commands) to take care of execution and not keep receive commands busy


I could incorporate setgGPIO into exe commands, that would cut delay in half. But in setGPIO there are potential waits in teh commands. so before I do that I need to understand all the other consequences.

so if 15 secs delay for the sprinkle is not a problem .. this is then lower priority.

Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: GreenIQ - Model B - Irrigation and PiBeacon

Post by kw123 »

actually it was not so complicated..

Have a version ready that skips setGPIO and does it in execcommands

if you like to test it. it should cut down the delay from 15 to < 8 secs on your RPI1

if you like to try:
https://www.dropbox.com/s/eydnqjyobysau ... n.zip?dl=1

after you test I will publish

Karl

changes:

Code: Select all

Added features / changes in v7.103.276 @ 2019-05-07
===================================================

1. moved setGPIO command into execcommands. that reduces delay with older RPI ie RPI1

2. now all pibeacon logfiles on the RPI are in ONE file: /var/log/piBeacon.log
it looks like:
date              module       debuglvl message 
20190507-12:56:30 copyToTemp      L:-1= killing copyToTemp.py    
20190507-12:56:30 sunDial         L:-2= move  return due to: direction1, inFixBoundaryMode:0 cap switch sens: 0;   switch sensor:0 
20190507-12:56:30 sunDial         L:-3= 1100 === 34 1  
20190507-12:56:31 master          L:-1=  IP find:::: wifiIP >><<; eth0IP: >>192.168.1.39<<;   hostnameIP >>['192.168.1.39']<<;   ipAddressRead >>192.168.1.39<< 
20190507-12:56:31 sunDial         L:-2= move  return due to: direction-1, inFixBoundaryMode:0 cap switch sens: 0;   switch sensor:0 
20190507-12:56:31 sunDial         L:-3= 1300 === 85 -1  
20190507-12:56:31 master          L:-1=  master can ping indigo server at ip:>>192.168.1.50<< 
20190507-12:56:32 installLibs     L:-1=  installLibs starting  
20190507-12:56:32 installLibs     L:-1=  installLibs no opsys upgrade requested 
 
20190507-14:59:04 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': True, u'command': u'down', u'pin': u'26'} 
20190507-14:59:04 execcommands    L: 1= next cmd: "down" 
20190507-14:59:04 execcommands    L: 0= setGPIO pid=16700,  command :{'startAtDateTime': u'1557259144.27', 'values': {}, 'pin': '26', 'debug': 3, 'inverseGPIO': True, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190507-14:59:04 execcommands    L: 0= msg: 156x-6-api_IN_14x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"high"}}},"program":"execcommands","ipAddress":"","pi":"14","ts":{"tz":"CDT","time":1557259144.16}}
 
20190507-14:59:04 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': True, u'command': u'down', u'pin': u'5'} 
20190507-14:59:04 execcommands    L: 1= next cmd: "down" 
20190507-14:59:04 execcommands    L: 0= setGPIO pid=16707,  command :{'startAtDateTime': u'1557259144.36', 'values': {}, 'pin': '5', 'debug': 3, 'inverseGPIO': True, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190507-14:59:04 execcommands    L: 0= msg: 156x-6-api_IN_14x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"high"}}},"program":"execcommands","ipAddress":"","pi":"14","ts":{"tz":"CDT","time":1557259144.29}}
AndyVirus
Posts: 257
Joined: Tue Mar 18, 2014 11:47 am
Location: Newport Pagnell, UK

Re: GreenIQ - Model B - Irrigation and PiBeacon

Post by AndyVirus »

I have installed and tested remotely so assume the valves are doing what they do :-)

Code: Select all

20190508-10:21:51 receiveCommands L: 2= len of buffer:409 
20190508-10:21:51 receiveCommands L: 2= len of buffer:0 
20190508-10:21:51 receiveCommands L: 2= len of package:409 
20190508-10:21:51 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "4"} 
20190508-10:21:51 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "17"} 
20190508-10:21:51 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "27"} 
20190508-10:21:51 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "22"} 
20190508-10:21:51 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "23"} 
20190508-10:21:52 receiveCommands L: 2= len of buffer:235 
20190508-10:21:52 receiveCommands L: 2= len of buffer:0 
20190508-10:21:52 receiveCommands L: 2= len of package:235 
20190508-10:21:52 receiveCommands L: 1=  cmd= {"restoreAfterBoot": "0", "startAtDateTime": 0, "pin": "24", "inverseGPIO": false, "devId": 1128735305, "values": {"analogValue": 0.0, "pulseDown": 0.0, "pulseUp": 600.0, "nPulses": 0}, "device": "OUTPUTgpio-1", "command": "pulseUp"} 
20190508-10:21:52 receiveCommands L: 2= len of buffer:235 
20190508-10:21:52 receiveCommands L: 2= len of buffer:0 
20190508-10:21:52 receiveCommands L: 2= len of package:235 
20190508-10:21:52 receiveCommands L: 1=  cmd= {"restoreAfterBoot": "0", "startAtDateTime": 0, "pin": "18", "inverseGPIO": false, "devId": 1128735305, "values": {"analogValue": 0.0, "pulseDown": 0.0, "pulseUp": 600.0, "nPulses": 0}, "device": "OUTPUTgpio-1", "command": "pulseUp"} 
20190508-10:21:58 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'4'} 
20190508-10:21:58 execcommands    L: 1= next cmd: "down" 
20190508-10:21:58 execcommands    L: 0= setGPIO pid=8819,  command :{'startAtDateTime': u'1557307318.59', 'values': {}, 'pin': '4', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:21:59 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'17'} 
20190508-10:21:59 execcommands    L: 1= next cmd: "down" 
20190508-10:21:59 execcommands    L: 0= setGPIO pid=8821,  command :{'startAtDateTime': u'1557307319.34', 'values': {}, 'pin': '17', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:21:59 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307318.75}}
 
20190508-10:21:59 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'27'} 
20190508-10:21:59 execcommands    L: 1= next cmd: "down" 
20190508-10:21:59 execcommands    L: 0= setGPIO pid=8823,  command :{'startAtDateTime': u'1557307319.81', 'values': {}, 'pin': '27', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:22:00 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307319.48}}
 
20190508-10:22:00 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'22'} 
20190508-10:22:00 execcommands    L: 1= next cmd: "down" 
20190508-10:22:00 execcommands    L: 0= setGPIO pid=8825,  command :{'startAtDateTime': u'1557307320.47', 'values': {}, 'pin': '22', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:22:00 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307319.94}}
 
20190508-10:22:00 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'23'} 
20190508-10:22:00 execcommands    L: 1= next cmd: "down" 
20190508-10:22:00 execcommands    L: 0= setGPIO pid=8827,  command :{'startAtDateTime': u'1557307320.64', 'values': {}, 'pin': '23', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:22:00 execcommands    L:-1= next command: {u'restoreAfterBoot': u'0', u'startAtDateTime': 0, u'pin': u'24', u'inverseGPIO': False, u'devId': 1128735305, u'values': {u'analogValue': 0.0, u'pulseDown': 0.0, u'pulseUp': 600.0, u'nPulses': 0}, u'device': u'OUTPUTgpio-1', u'command': u'pulseUp'} 
20190508-10:22:00 execcommands    L: 1= next cmd: "pulseUp" 
20190508-10:22:00 execcommands    L: 0= setGPIO pid=8829,  command :{'startAtDateTime': 1557307320.843068, 'values': {u'analogValue': 0.0, u'pulseDown': 0.0, u'pulseUp': 600.0, u'nPulses': 0}, 'pin': '24', 'debug': 3, 'inverseGPIO': False, 'cmd': u'pulseUp', 'devId': 1128735305, 'PWM': 1} 
20190508-10:22:00 execcommands    L:-1= next command: {u'restoreAfterBoot': u'0', u'startAtDateTime': 0, u'pin': u'18', u'inverseGPIO': False, u'devId': 1128735305, u'values': {u'analogValue': 0.0, u'pulseDown': 0.0, u'pulseUp': 600.0, u'nPulses': 0}, u'device': u'OUTPUTgpio-1', u'command': u'pulseUp'} 
20190508-10:22:00 execcommands    L: 1= next cmd: "pulseUp" 
20190508-10:22:01 execcommands    L: 0= setGPIO pid=8831,  command :{'startAtDateTime': 1557307320.998413, 'values': {u'analogValue': 0.0, u'pulseDown': 0.0, u'pulseUp': 600.0, u'nPulses': 0}, 'pin': '18', 'debug': 3, 'inverseGPIO': False, 'cmd': u'pulseUp', 'devId': 1128735305, 'PWM': 1} 
20190508-10:22:01 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307320.55}}
 
20190508-10:22:01 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307320.76}}
 






20190508-10:22:58 receiveCommands L: 2= len of buffer:573 
20190508-10:22:58 receiveCommands L: 2= len of buffer:0 
20190508-10:22:58 receiveCommands L: 2= len of package:573 
20190508-10:22:58 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "4"} 
20190508-10:22:58 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "17"} 
20190508-10:22:58 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "18"} 
20190508-10:22:58 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "27"} 
20190508-10:22:59 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "22"} 
20190508-10:22:59 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "23"} 
20190508-10:22:59 receiveCommands L: 1=  cmd= {"device": "OUTPUTgpio-1", "inverseGPIO": false, "command": "down", "pin": "24"} 
20190508-10:23:05 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'4'} 
20190508-10:23:05 execcommands    L: 1= next cmd: "down" 
20190508-10:23:05 execcommands    L: 0= setGPIO pid=8927,  command :{'startAtDateTime': u'1557307385.61', 'values': {}, 'pin': '4', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:23:06 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'17'} 
20190508-10:23:06 execcommands    L: 1= next cmd: "down" 
20190508-10:23:06 execcommands    L: 0= setGPIO pid=8929,  command :{'startAtDateTime': u'1557307386.24', 'values': {}, 'pin': '17', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:23:06 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307385.75}}
 
20190508-10:23:06 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'18'} 
20190508-10:23:06 execcommands    L: 1= next cmd: "down" 
20190508-10:23:06 execcommands    L: 0= setGPIO pid=8931,  command :{'startAtDateTime': u'1557307386.77', 'values': {}, 'pin': '18', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:23:06 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307386.37}}
 
20190508-10:23:06 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'27'} 
20190508-10:23:07 execcommands    L: 1= next cmd: "down" 
20190508-10:23:07 execcommands    L: 0= setGPIO pid=8933,  command :{'startAtDateTime': u'1557307387.05', 'values': {}, 'pin': '27', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:23:07 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'22'} 
20190508-10:23:07 execcommands    L: 1= next cmd: "down" 
20190508-10:23:07 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307386.89}}
 
20190508-10:23:07 execcommands    L: 0= setGPIO pid=8935,  command :{'startAtDateTime': u'1557307387.45', 'values': {}, 'pin': '22', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:23:07 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'23'} 
20190508-10:23:07 execcommands    L: 1= next cmd: "down" 
20190508-10:23:07 execcommands    L: 0= setGPIO pid=8937,  command :{'startAtDateTime': u'1557307387.52', 'values': {}, 'pin': '23', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:23:07 execcommands    L:-1= next command: {u'device': u'OUTPUTgpio-1', u'inverseGPIO': False, u'command': u'down', u'pin': u'24'} 
20190508-10:23:07 execcommands    L: 1= next cmd: "down" 
20190508-10:23:07 execcommands    L: 0= setGPIO pid=8939,  command :{'startAtDateTime': u'1557307387.67', 'values': {}, 'pin': '24', 'debug': 3, 'inverseGPIO': False, 'cmd': u'down', 'devId': 0, 'PWM': 1} 
20190508-10:23:07 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307387.19}}
 
20190508-10:23:08 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307387.59}}
 
20190508-10:23:08 execcommands    L: 0= msg: 154x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307387.57}}
 
20190508-10:23:08 execcommands    L: 0= msg: 153x-6-api_IN_4x-6-a{"outputs":{"OUTPUTgpio-1-ONoff":{"0":{"actualGpioValue":"low"}}},"program":"execcommands","ipAddress":"","pi":"4","ts":{"tz":"BST","time":1557307387.8}}
 

So looks like its down to 8 - 10 seconds on this old Pi! Thanks!
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: GreenIQ - Model B - Irrigation and PiBeacon

Post by kw123 »

ok thanks

will publish the official version

added: when 2 commands for the same GPIO are send in sequence ( eg pulse up for 600 secs; then indigo/ user sends a down after 30 secs ) , the first one is still active.
Now the second will cancel the first and then execute.

setGPIO did that (cancel itself in previous process) , and now execcommands will do it too.


Karl
Post Reply

Return to “piBeacon”