Hey guys,
I configured .items, .things and .sitemaps file.
I can also find it in the paperUI but not in the basicUI why?
Hey guys,
I configured .items, .things and .sitemaps file.
I can also find it in the paperUI but not in the basicUI why?
What about posting your .items.things.sitemap and your log files. It’s hard to tell without further details.
.items
Switch ONSub “Subwoofer ON” {channel=“exec:command:switchOn:run”}
//Switch ONSub “Subwoofer ON” (Wohnzimmer) {exec=">[OFF:sudo /opt/rc-switch/rcwitch-pi/433Utils/RPi_utils/switchON.sh 1]>[ON:sudo /opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOFF.sh 1]"}
Switch ONSub “Subwoofer ON” {channel=“exec:command:ON:input”}
//Switch ONSub "Subwoofer ON"
Switch OFFSub “Subwoofer OFF”{channel=“exec:command:switchOff:run”}
.things
Thing exec:command:ONSub [command="/opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOn.sh %2$s", interval=0, autorun=true]
Thing exec:command:OFFSub [command="/opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOff.sh %2$s", interval=0, autorun=true]
.sitemap
//sitemap steckdose label=“Steckdose” {
// Frame label=“Funkstechdose” {
Switch item=ONSub mappings=[“on”=“ON”, “off”=“OFF”]
// Switch item=Dash_Switch
// }
//}
where can i get the log file?
Log file can be found under /userdata/log, but iguess it is not needed.
Your .sitemap file is absolutely wrong, it is missing major parts.
I would suggest to read
http://docs.openhab.org/configuration/sitemaps.html
@Trainer I might be wrong but I think you use openhab 1 syntax.
Have a look here for openhab 2 syntax and a basic tutorial how to use the exec binding.
Read the whole thread as there is a lot guidance to find there. Maybe this helps.
Please use code fences for your code.
Code goes here
Use the buttons over the text entry field for that.
BasicUI is unable to display anything because you commented almost your complete sitemap out.
I suggest to use a simple rule instead of the exec binding.
rule "subwoofer einaus"
when
Item Subwoofer received command
then
if (receivedCommand==ON)
{
executeCommandLine("/opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOn.sh 1")
}
else
{
executeCommandLine("/opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOff.sh 1")
}
end
item
Switch Subwoofer “Subwoofer [%s]"
sitemap
sitemap steckdose label="Steckdose"
{
Frame label="Funksteckdose"
{
Switch item=Subwoofer
}
}
Thank you. i tried your version but it also didn’t work
i got this error
23:02:21.361 [ERROR] [.ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Subwoofer' for widget org.eclipse.smarthome.model.sitemap.Switch
23:02:21.369 [ERROR] [.ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
23:02:21.376 [ERROR] [.ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Subwoofer' for widget org.eclipse.smarthome.model.sitemap.Switch
23:02:21.385 [ERROR] [.ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Subwoofer' for widget org.eclipse.smarthome.model.sitemap.Switch
23:02:21.393 [ERROR] [.ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Subwoofer' for widget org.eclipse.smarthome.model.sitemap.Switch
edit: Sorry my fault.
i forgot to add sudo before the executeCommandLine
executeCommandLine("sudo /opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOn.sh 1")
}
Thank you.
I tried your hint https://community.openhab.org/t/no-switch-button-in-basicui/38323/5 and chanced send to codeäsend (because i only know the codesend number) but after i change it in rules
if(receivedCommand == ON){
Remote_Send_Args.sendCommand("1397845")
}else{
Remote_Send_Args.sendCommand("1397844“)
}
but i have no luck
The error messages show that you didn’t create the *.items file.
@Trainer please post your full setup!
.rules
rule "subwoofer einaus"
when
Item Subwoofer received command
then
if (receivedCommand==ON)
{
executeCommandLine("sudo /opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOn.sh 1")
}
else
{
executeCommandLine("sudo /opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOff.sh 1")
}
end
.items
Switch Subwoofer “Subwoofer [%s]"
.sitemap
sitemap steckdose label="Wohnzimmer"
{
Frame label="Funksteckdose"
{
Switch item=Subwoofer
}
}
@Trainer and the log when toggling the Switch?
Rebooting the RPI is a good idea, any time!
Did you follow the instructions?
If you need sudo there is almost something wrong with your permission. But if you really want it this is how it has to be made!
Did you execute a sudo command as user openhab/openhabian?
But lets try to get it done without sudo!
sudo adduser openhab gpio
sudo -u openhab /opt/rc-switch/rcswitch-pi/433Utils/RPi_utils/switchOff.sh 1
What is the result when executing this two lines?
Hey @Trainer,
Did you do this step “Set the default sitemap via the Paper UI via Configuration → Services → Basic UI → Configure, and set the Default Sitemap name” ?
Ex :
steckdose.sitemap
sitemap steckdose label=“Steckdose” {
Frame label=“Funkstechdose” {
Switch item=ONSub mappings=[“on”=“ON”, “off”=“OFF”]Switch item=Dash_Switch
}
}
and set steckdose is default sitemap name
adduser: The group `gpio’ does not exist
i got this error message with your command.
wiringPiSetup: Unable to open /dev/mem or /dev/gpiomem: Permission denied.
Try running with sudo?
i change steckdose to powerplugs, because my filename is also powerplugs.sitemap
What is your setup?
Why is there no gpio group? Do you have wiringpi installed?
Did you try it as root?
sudo -u openhab sudo /opt/rc-switch/rcswitch-pi
I still have the feeling you did not follow every step explain in the tutorial. I would advise to start over again. Maybe with a fresh install of your Linux. And then follow every step in the tutorial.
In the second example for the led stripe i also use codesend.
I installed wiringpi now, but i have the same gpis group problem.
After your command i got this message:
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.[sudo] password for openhab:
i don’t know the password for the user openhab
everything works fine, so i don’t want to reinstall everything new-
@Trainer please post what is returned for those command, after you have rebooted the PI.
cat /etc/group
cat /etc/passwd
ls -la /sys/class/gpio/export
ls -la /sys/class/gpio
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:openhab,pi
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:openhab,pi
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:pi
audio:x:29:openhab
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
input:x:101:
systemd-journal:x:102:
systemd-timesync:x:103:
systemd-network:x:104:
systemd-resolve:x:105:
systemd-bus-proxy:x:106:
crontab:x:107:
messagebus:x:108:
ntp:x:109:
netdev:x:110:
ssh:x:111:
pi:x:1000:
avahi:x:112:
sambashare:x:113:
Debian-exim:x:114:
openhab:x:115:pi
ssl-cert:x:116:
ftp:x:117:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-timesync:x:100:103:systemd Time Synchronization,:/run/systemd:/bin/false
systemd-network:x:101:104:systemd Network Management,:/run/systemd/netif:/bin/false
systemd-resolve:x:102:105:systemd Resolver,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:103:106:systemd Bus Proxy,:/run/systemd:/bin/false
messagebus:x:104:108::/var/run/dbus:/bin/false
ntp:x:105:109::/home/ntp:/bin/false
sshd:x:106:65534::/var/run/sshd:/usr/sbin/nologin
pi:x:1000:1000:,:/home/pi:/bin/bash
avahi:x:107:112:Avahi mDNS daemon,:/var/run/avahi-daemon:/bin/false
Debian-exim:x:108:114::/var/spool/exim4:/bin/false
openhab:x:109:115:openhab2 runtime user,:/var/lib/openhab2:/bin/false
ftp:x:110:117:ftp daemon,:/srv/ftp:/bin/false
–w------- 1 root root 4096 Jan 1 1970 /sys/class/gpio/export
total 0
drwxr-xr-x 2 root root 0 Jan 24 11:14 .
drwxr-xr-x 48 root root 0 Jan 1 1970 …
–w------- 1 root root 4096 Jan 24 11:14 export
lrwxrwxrwx 1 root root 0 Jan 1 1970 gpiochip0 → …/…/devices/platform/soc/3f200000.gpio/gpio/gpiochip0
–w------- 1 root root 4096 Jan 1 1970 unexport
@Trainer so you miss the gpio group and all files which should have permission set for gpio are not set correctly.
Maybe a
sudo apt-get update
sudo apt-get dist-upgrade
would be the best choice. And then reinstall wiringPI
But here is what i found on how to set gpio and the file permission. I did not set it up myself.
Create a gpio group first:
groupadd gpio
add your users to that group:
usermod -a -G gpio pi
usermod -a -G gpio openhab
Test if it went right.
pi@raspberrypi:~ $ grep gpio /etc/group
gpio:x:997:pi,openhab
Reboot
Fix permissions of the sysfs GPIO file system.
sudo nano /etc/rc.local
add following to the bottom
chown -R root:gpio /sys/class/gpio
chmod -R ug+rw /sys/class/gpio
Next set up an udev rule to enable non root and gpio group user to acces GPIO files.
sudo nano /etc/udev/rules.d/80-gpio-noroot.rules
# /etc/udev/rules.d/80-gpio-noroot.rules
# Acces to GPIO without root
#
# Change group
SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chown -R root:gpio /sys/devices/platform/soc/*.gpio/gpio'"
# set acces permission
SUBSYSTEM=="gpio", PROGRAM="/bin/sh -c '/bin/chmod -R ug+rw /sys/devices/platform/soc/*.gpio/gpio'"
No reboot just trigger the rule.
sudo udevadm trigger --subsystem-match=gpio
But rebooting is always a good idea.
Edit: additional this has to be set
The file permission to gpiomem should look like this
$ ls -l /dev/gpiomem
crw-rw---- 1 root gpio 244, 0 Dec 28 22:51 /dev/gpiomem
If it is different change it with
sudo chown root:gpio /dev/gpiomem
sudo chmod g+rw /dev/gpiomem