echo unexporting all
sudo sh -c 'echo "2" > /sys/class/gpio/unexport'
sudo sh -c 'echo "3" > /sys/class/gpio/unexport'
sudo sh -c 'echo "4" > /sys/class/gpio/unexport'
sudo sh -c 'echo "17" > /sys/class/gpio/unexport'
sudo sh -c 'echo "27" > /sys/class/gpio/unexport'
sudo sh -c 'echo "22" > /sys/class/gpio/unexport'
sudo sh -c 'echo "10" > /sys/class/gpio/unexport'
sudo sh -c 'echo "9" > /sys/class/gpio/unexport'
sudo sh -c 'echo "11" > /sys/class/gpio/unexport'
sudo sh -c 'echo "5" > /sys/class/gpio/unexport'
sudo sh -c 'echo "6" > /sys/class/gpio/unexport'
sudo sh -c 'echo "13" > /sys/class/gpio/unexport'
sudo sh -c 'echo "19" > /sys/class/gpio/unexport'
sudo sh -c 'echo "26" > /sys/class/gpio/unexport'
sudo sh -c 'echo "14" > /sys/class/gpio/unexport'
sudo sh -c 'echo "15" > /sys/class/gpio/unexport'
sudo sh -c 'echo "18" > /sys/class/gpio/unexport'
sudo sh -c 'echo "23" > /sys/class/gpio/unexport'
sudo sh -c 'echo "24" > /sys/class/gpio/unexport'
sudo sh -c 'echo "25" > /sys/class/gpio/unexport'
sudo sh -c 'echo "8" > /sys/class/gpio/unexport'
sudo sh -c 'echo "7" > /sys/class/gpio/unexport'
sudo sh -c 'echo "12" > /sys/class/gpio/unexport'
sudo sh -c 'echo "16" > /sys/class/gpio/unexport'
sudo sh -c 'echo "20" > /sys/class/gpio/unexport'
sudo sh -c 'echo "21" > /sys/class/gpio/unexport'
echo Done unexporting
this how the unexporting script needs to look like, note the differnces between " and ’
I don’t understand why but it works now, at least for time being…
And thanks joroen, i think I also will add the buzzer to my setup… My only problem now is that I have run out of GPIO’s, so I might have to add arduino or something else:)
2015-09-18 18:49:31.355 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule 'Initialize light states': Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null
2015-09-18 18:49:32.193 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule 'Initialize heating states': Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null
2015-09-18 18:49:32.966 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule 'Initialize contact states': Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null
this is what I see as user rights in gpio before i start openhab
pi@raspberrypi ~ $ ls -l /sys/class/gpio/
total 0
-rwxrwx--- 1 root gpio 4096 Oct 9 09:22 export
lrwxrwxrwx 1 root gpio 0 Jan 1 1970 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx--- 1 root gpio 4096 Oct 9 09:23 unexport
2015-10-09 09:41:15.949 [INFO ] [runtime.busevents ] - Heating_FF_Bath state updated to Undefined
2015-10-09 09:41:16.015 [INFO ] [runtime.busevents ] - Light_Module2 state updated to Undefined
2015-10-09 09:41:16.037 [INFO ] [runtime.busevents ] - Light_Module1 state updated to Undefined
2015-10-09 09:41:16.063 [INFO ] [runtime.busevents ] - Light_Balcony state updated to OFF
2015-10-09 09:41:16.170 [INFO ] [runtime.busevents ] - Light_Module1 state updated to OFF
2015-10-09 09:41:16.674 [INFO ] [runtime.busevents ] - Light_Module2 state updated to OFF
so what am I doing wrong? I now start and stop openhab by using
sudo sh resetGpio.sh
sudo sh /home/pi/openhab/start.sh
There are a lot of tutorials out there with all sorts of instructions for how and where to put it. Most are out of date.
The preferred installation approach on Debian based Linux machines (Raspbian, Ubuntu, Mint, etc) is to use apt-get as described here. This will create the openhab user and group, set openhab to start as a service, let you upgrade b
oth openHAB and addons automatically, and put the various parts of openhab in standardized locations
Config: /etc/openhab
openHAB home: /usr/share/openhab
addons: /usr/share/openhab/addons
webapps (where Habmin goes, location of icons): /usr/share/openhab/webapps
Will reinstall it tonight and try it out again, I had it installed in /home/pi everything… Because that was what a probably outdated tutorial on instructables said…
Send me a link to that Instructables or post it here. I know @watou has contacted the author of at least one Instructable author about his outdated instructions but I don’t think this was the same one. At a minimum I can put a comment on it pointing to the more up to date instructions.
Couldn’t find the one with /home/pi right now, have it bookmarked on my personal laptop somwhere.
A final note, how do I change the state of a gpio in my rule, sendCommand(Module1, ON) does not do the the trick if its ON and i want to set it to off.
Reinstalling seems so far to work, thanks rlkoshak:) However how can I send the command to turn on my light from my switch, the log file shows that its detected state change but this sendCommand(Light_Kitchen_Item, ON) does not turn it on.
It should just be a matter of configuring the item correctly. Unfortunately I’ve not used GPIO from openHAB so I have no experience to draw upon to help.
Frame label="Debug" {
Group item=Lights icon="light"
Group item=Switches label="Contacts" icon="kitchen"
Group item=Heating label="Heating" icon="bath"
Group item=rgb label="RGB Switch"
}
and this is my rule file:
import org.openhab.core.library.type.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.openab.core.types.command
import org.openhab.core.items.genericitem
import java.util.Date
import java.text.SimpleDateFormat
rule "Switch detection"
when
Item Contact_LivingRoom1 received update
then
var String Timestamp = String::format( "%1$tH:%1$tM:%1$tS %1$tY-%1$tm-%1$td", new Date() )
logInfo("test", "Contact_LivingRoom1 state change. State = " + Contact_LivingRoom1.state)
sendCommand("Light_Kitchen", "ON")
executeCommandLine("echo halla")
sendMail("skatun@gmail.com", "Contact_LivingRoom1 state received: (" + Contact_LivingRoom1.state + ")", "Contact switched at " + Timestamp)
end
rule "HAG system start"
when
System started
then
var String Timestamp = String::format( "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS", new Date() )
sendMail("skatun@gmail.com", "HAG system started", "The HAG system started on: " + Timestamp)
end
From what I see, depending on what triggers this rule if Light_Kitchen is OFF the rule will immediately turn it back ON and visa versa. Not sure why you would want to do this.
What triggers this rule? If it is Item Light_Kitchen received update or something similar you may have found the most efficient way to lock openHAB into an infinite loop I can think of. This is what would happen. Light_Kitchen is set to OFF, rule triggers because it received an update, rule sets the light to ON, rule triggers because it received an update, rules sets light to OFF, … forever.
Perhaps it would help if I understood why you want to immediately reset the switch.
The lines where you call Light_Kitchen.state = don’t do anything. To set the state call either sendCommand or postUpdate.
rule "Switch detection"
when
Item Contact_LivingRoom1 received update
then
well I have a push button, spring loaded,
This is what i want to achieve…
so if my light is on and i push it will switch it off,
Then I go to my laptop for instance, switch it back on,
then i push my button , lights off. Then i ush my button again, lights on.
I just want my physically switch to change the light state, if its on then off, if its off then on and so on. But this should also be reflected in the GUI…