Input toggles output in Raspberry

Posted on
Tue Nov 20, 2018 2:24 am
Sam offline
Posts: 29
Joined: Aug 22, 2016

Input toggles output in Raspberry

Hi,

I would like an input (pushbutton) in Raspberry Pi to toggle an output each time input becomes high. How do you get that feature?
I would also like the output to show status (ON or OFF) in Indigo state at that time of operation. Is it possible?
Of course, you can create this via a trigger in Indigo, but I would like the feature to be in RBpi.

Thanks in advance!

/Sam
Attachments
01.JPG
01.JPG (101.7 KiB) Viewed 643 times

Posted on
Tue Nov 20, 2018 7:44 am
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

Yes, after thanksgiving.


Sent from my iPhone using Tapatalk

Posted on
Tue Nov 20, 2018 11:23 am
Sam offline
Posts: 29
Joined: Aug 22, 2016

Re: Input toggles output in Raspberry

Great! Thanks.

/Sam

Posted on
Tue Nov 20, 2018 12:42 pm
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

the string for the GPIO should work as you show it..

I guess you want to have the indigo device/state status to show ON/Off the the output gpio? .. the is not implemented as you circumvent the indigo part..
But you could use the GPIO in for that?


just a question.. how do you set it to OFF? with the down button, or another button?

Karl

Posted on
Tue Nov 20, 2018 1:42 pm
Sam offline
Posts: 29
Joined: Aug 22, 2016

Re: Input toggles output in Raspberry

Sorry,
What i meant was... i want the same pushbutton (normally open) connected to the input, to change the status of the output by an pulse on the input. The first pulse - sets the output to 1, the next pulse sets the output to 0 etc, if possible?

/Sam

Posted on
Tue Nov 20, 2018 2:55 pm
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

this
Code: Select all
if (gpio -g read 18 | grep 1 ); then  gpio -g write 18 0; else gpio -g write 18 1 ; fi
should set gpio18 to 1 if current 0 and to 0 if currently 1 == toggle

Posted on
Wed Nov 21, 2018 12:19 am
Sam offline
Posts: 29
Joined: Aug 22, 2016

Re: Input toggles output in Raspberry

Works perfect!

Thanks Karl!

/Sam

Posted on
Wed Nov 21, 2018 8:53 am
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

Cool. Thanks for feedback.
Will add this to device edit menu as an example.


Sent from my iPhone using Tapatalk

Posted on
Mon Dec 10, 2018 1:43 am
Sam offline
Posts: 29
Joined: Aug 22, 2016

Re: Input toggles output in Raspberry

Hi,

I have installed the latest version 7.98.255 and have some problems with the OUTPUT-GPIO-1-ON/off.
The Indigo state of that output shows ”off” when my relay is activated and ”on” when its deactivated.
I tried to inverse the OUTPUT type but do not get it right anyway.
Is there any setting for reverse that function that I have missed?

Another question..
I have a couple of RPi's that I only use for GPIO's and displays. Is there any easy way to turn off the beacon function in these Pi:s and only use the sensors, input, output and displays?

/Sam

Posted on
Mon Dec 10, 2018 7:54 am
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

A). the inverse option in device edit should do what you want ..
the device states show 3 states:
1.OUTPUT_00 = command send to raspberry * inversion factor
2. actual GpoiValue = is the physical output high/ low
3. Status = output_00

status and output are the same, just historical . In devices with many outputs 00-24 you could select which output is used for status.
I have stopped supporting multiple output sper indigo device.

so play with inverses/normal in device edit that SHOULD do it.

B) use non beacon RPI
1. delete RPI in initial setup
2. wait 1 minute, may be reload plugin, to clear everything
3. make new RPI with sensor only (# 10..19) in initial setup.

Karl

Posted on
Mon Dec 10, 2018 11:17 am
Sam offline
Posts: 29
Joined: Aug 22, 2016

Re: Input toggles output in Raspberry

Thanks,

In my previous version (7.94.244), the control of the output worked well, but now I can not get Indigo state to show "on" when the physical relay is active, regardless of whether I set the output type as normal or inverse.

/Sam

Posted on
Mon Dec 10, 2018 11:22 am
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

could you post parameters file from the RPi (is also on you indigo mac ~/indigo/pibeacon/parameters.x)

remove pwd ..

Karl

Posted on
Mon Dec 10, 2018 11:48 am
Sam offline
Posts: 29
Joined: Aug 22, 2016

Re: Input toggles output in Raspberry

Is this the correct file?

Code: Select all
{
  "BLEserial": "sequential",
  "GPIOpwm": "1",
  "IPnumberOfRPI": "192.168.10.21",
  "IndigoOrSocket": "indigo",
  "acceptJunkBeacons": "0",
  "acceptNewiBeacons": -999,
  "addNewOneWireSensors": "0",
  "authentication": "digest",
  "bluetoothONoff": "on",
  "debugRPI": {
    "debugRPIBEACON": 0,
    "debugRPIBLE": 0,
    "debugRPICALL": 0,
    "debugRPIOUTPUT": 0,
    "debugRPISENSOR": 0,
    "debugRPImystuff": 0
  },
  "deleteHistoryAfterSeconds": 86400,
  "deltaChangedSensor": "5",
  "distanceUnits": "1.0",
  "enableMuxI2C": "0",
  "enableRebootCheck": "restartLoop,-",
  "enableiBeacons": "0",
  "indigoInputPORT": 12087,
  "ipOfServer": "192.168.10.11",
  "minPinActiveTimeForShutdown": 60,
  "myPiNumber": "10",
  "networkType": "fullIndigo",
  "output": {
    "OUTPUTgpio-1-ONoff": {
      "17624462": [
        {
          "gpio": "21",
          "initialValue": "-",
          "outType": "0"
        }
      ]
    }
  },
  "passwordOfServer": "XXXXX",
  "portOfServer": "8176",
  "pressureUnits": "bar",
  "rPiCommandPORT": "9999",
  "rPiRestartCommand": "master",
  "rebootCommand": "sudo killall -9 python; sleep 2;sudo reboot",
  "rebootHour": 1,
  "rebootWatchDogTime": "-1",
  "restartBLEifNoConnect": false,
  "sendAfterSeconds": "60",
  "sendFullUUID": "0",
  "sendToIndigoSecs": 90,
  "sensorList": "",
  "sensorRefreshSecs": 20.0,
  "sensors": {},
  "shutDownPinInput": -1,
  "shutDownPinOutput": -1,
  "tempUnits": "Celsius",
  "timeStamp": "2018-12-10-18:15:25",
  "useRTC": "0",
  "useRamDiskForLogfiles": "0",
  "userIdOfServer": "Indigo",
  "wifiOFF": "off"
}


/Sam

Posted on
Mon Dec 10, 2018 12:27 pm
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

yes looks good...

could you go into the rpi and do:

cd pibeacon
sudo python master.py
tail -F temp/messageSend

w capital F

it should show any messages and also error messages

you should see something like this:
Code: Select all
tail -F temp/messageSend
OUTPUTgpio:  {"outputs":{"OUTPUTgpio-1-ONoff":{"1964742022":{"actualGpioValue":"low"}}},"program":"OUTPUTgpio","ipAddress":"192.168.1.198","pi":"0"}

and some other lines

and do ps -ef | grep .py
should show:
Code: Select all
pi@raspberrypi:~/pibeacon $ ps -ef | grep .py
nobody     288     1  0 02:00 ?        00:00:00 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket /run/thd.socket --user nobody --deviceglob /dev/input/event*
pi        3044  2631  0 12:25 pts/0    00:00:00 grep --color=auto .py
root     30898     1  0 11:07 ?        00:00:06 /usr/bin/python /home/pi/pibeacon/master.py
root     31355     1  0 11:07 ?        00:00:02 /usr/bin/python /home/pi/pibeacon/copyToTemp.py
root     31482     1  0 11:07 ?        00:00:34 /usr/bin/python /home/pi/pibeacon/OUTPUTgpio.py   <<<<<=== this must run
root     31519     1  0 11:07 ?        00:00:22 /usr/bin/python /home/pi/pibeacon/INPUTgpio.py
root     31582     1  0 11:07 ?        00:00:10 /usr/bin/python /home/pi/pibeacon/tmp006.py
root     31588     1  0 11:07 ?        00:00:01 /usr/bin/python /home/pi/pibeacon/receiveGPIOcommands.py 9999
root     31821     1  4 11:07 ?        00:03:34 /usr/bin/python /home/pi/pibeacon/beaconloop.py
root     31972     1  0 11:07 ?        00:00:02 /usr/bin/python /home/pi/pibeacon/BLEconnect.py


Karl

Posted on
Mon Dec 10, 2018 12:46 pm
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: Input toggles output in Raspberry

the line
"outType": "1"
should flip when you do normal/inverse.

and did you post the file from the RPI or from the indigo MAC.ie are the files updated?
do a menu send xxxx "all programs .." to the RPIs

Karl

Who is online

Users browsing this forum: No registered users and 0 guests