Raspbian update
sudo apt-get update; sudo apt-get dist-upgrade
https://community.openhab.org/t/signature-problem-with-apt-get-update/6036
openhab version
http://1.30.1.212:8080/rest/
ZWave usb
/dev/ttyACM0
HOSTNAME
make your user part of the openhab group to be able to edit config files using openhap designer using a share:
useradd username group-name
have new user in same groups as pi”
Better (to avoid typing groups)
for GROUP in $(groups pi | sed ‘s/.*:\spi//’); do sudo adduser username $GROUP; done
[https://raspberrypi.stackexchange.com/questions/36168/how-to-create-new-user-in-raspberry-pi-who-has-equal-privileges-as-default-user]
sudo deluser username sudo
groups username
SAMBA
To share your openhab config to your pc running openhad designer:
http://superuser.com/questions/271034/list-samba-users
Do smbstatus as SUDO; normal user can not get access and get a NT_STATUS_ACCESS_DENIED
sudo smbstatus
sudo vi /etc/samba/smb.conf
sudo pdbedit -Lv
sudo service smbd restart
sudo smbd -b | grep PRIVATE_DIR
PRIVATE_DIR: /var/lib/samba/private
See
https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/install.html
Added to standard config, but encrypt should be defualt yes
encrypt passwords = yes
To be able to use to edit the config files in /etc/openhab2, change owner and group of this folder to ‘openhab’, and set permissition for this folder
sudo chmod g+w /etc/openhab2
sudo smbpasswd -a
sudo usermod -a -G openhab
And at end:
[OpenHABShare]
comment=OpenHAB Configuration Share
path=/etc/openhab2
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=no
available=yes
OpenHAB2
Automation/Orchestration Design Patterns
https://community.openhab.org/t/automation-orchestration-design-patterns/1967/20
https://github.com/openhab/openhab/wiki/Samples-Tricks#how-start-openhab-automatically-on-linux-using-systemd
systemctl status openhab2.service
tail -f /var/log/openhab2/openhab.log
OpenhabDesigner windows on Raspberry by
Add (empty) file ‘openhab_default.cfg’ to /etc/openhab2
https://community.openhab.org/t/using-openhab-designer-on-windows-with-openhab-on-linux/4687/3
openhab sample rules
next turns on lights on motion with timeout and switch items..
https://github.com/openhab/openhab/wiki/Taking-Rules-to-New-Heights
Auto reboot pi
sudo crontab -e
sudo crontab -l
30 1 * * * sudo reboot
http://docs.openhab.org/administration/console.html
https://mysmarthomeweb.wordpress.com/2016/07/31/small-examples-yahoo-weather-ntp-and-systems-service/
KARAF:
ssh openhab@localhost -p 8101
restart to reread config files:
bundle:list -s
bundle:restart org.eclipse.smarthome.model.core
setup mail:
http://openhab2.wermescher.com/action-mail-gmail/
Cleanup items and links using karaf
https://community.openhab.org/t/cannot-clean-the-mess-in-items/11271/4
https://www.thefanclub.co.za/how-to/how-setup-usb-3g-modem-raspberry-pi-using-usbmodeswitch-and-wvdial
sudo apt-get update
sudo apt-get install ppp usb-modeswitch wvdial
$ lsusb
Bus 001 Device 009: ID 05c6:1000 Qualcomm, Inc. Mass Storage Device
idVendor=05c6, idProduct=1000
/tmp $ sudo usb_modeswitch -W -v 05c6 -p 1000 -K
[sudo] password for juno:
Take all parameters from the command line
* usb_modeswitch: handle USB devices with multiple modes
* Version 2.2.0 (C) Josua Dietze 2014
* Based on libusb1/libusbx
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x05c6
DefaultProduct= 0x1000
StandardEject=1
NeedResponse=0
Look for default devices …
found USB ID 05c6:1000
vendor ID matched
product ID matched
found USB ID 0658:0200
found USB ID 0424:ec00
found USB ID 0424:9514
found USB ID 1d6b:0002
Found devices in default mode (1)
Access device 009 on bus 001
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)
USB description data (for identification)
————————-
Manufacturer: Qualcomm, Incorporated
Product: Qualcomm CDMA Technologies MSM
Serial No.: 351602000025260
————————-
Sending standard EJECT sequence
Looking for active driver …
OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending …
Trying to send message 1 to endpoint 0x01 …
OK, message successfully sent
Read the response to message 1 (CSW) …
Response successfully read (13 bytes).
Trying to send message 2 to endpoint 0x01 …
OK, message successfully sent
Read the response to message 2 (CSW) …
Response reading failed (error -1)
Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!
/tmp $ lsusb
Bus 001 Device 010: ID 05c6:6000 Qualcomm, Inc. Siemens SG75
Bus 001 Device 007: ID 0658:0200 Sigma Designs, Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
/tmp $ lsusb -v -d 05c6:6000
Bus 001 Device 010: ID 05c6:6000 Qualcomm, Inc. Siemens SG75
Couldn’t open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x05c6 Qualcomm, Inc.
idProduct 0x6000 Siemens SG75
http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=3&t=2670
http://cateee.net/lkddb/web-lkddb/USB_SERIAL_ZTE.html
http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=3&t=2565
http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=3&t=2565
usb_modeswitch -v 05c6 -p 1000-V 05c6 -P 6000 -M 55534243123456780000000000000011060000000000000000000000000000
dmesg:
[ 11.902783] usb 1-1.5: Product: Qualcomm CDMA Technologies MSM
[ 11.902793] usb 1-1.5: Manufacturer: Qualcomm, Incorporated
[ 11.902803] usb 1-1.5: SerialNumber: 351602000025260
[ 11.905794] usb-storage 1-1.5:1.0: USB Mass Storage device detected
[ 11.906923] scsi host0: usb-storage 1-1.5:1.0
[ 22.390696] random: crng init done
[ 40.917405] usb 1-1.5: USB disconnect, device number 8
[ 41.210686] usb 1-1.5: new high-speed USB device number 9 using dwc_otg
[ 41.343387] usb 1-1.5: New USB device found, idVendor=05c6, idProduct=6000
[ 41.343411] usb 1-1.5: New USB device strings: Mfr=3, Product=2, SerialNumber=4
[ 41.343423] usb 1-1.5: Product: Qualcomm CDMA Technologies MSM
[ 41.343434] usb 1-1.5: Manufacturer: Qualcomm, Incorporated
[ 41.343444] usb 1-1.5: SerialNumber: 351602000025260
[ 41.349624] usb-storage 1-1.5:1.4: USB Mass Storage device detected
[ 41.352063] scsi host0: usb-storage 1-1.5:1.4
[ 41.386810] usbcore: registered new interface driver usbserial
[ 41.386968] usbcore: registered new interface driver usbserial_generic
[ 41.387091] usbserial: USB Serial support registered for generic
[ 41.407558] usbcore: registered new interface driver option
[ 41.407726] usbserial: USB Serial support registered for GSM modem (1-port)
[ 41.408638] option 1-1.5:1.0: GSM modem (1-port) converter detected
[ 41.434694] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB0
[ 41.441886] option 1-1.5:1.1: GSM modem (1-port) converter detected
[ 41.449887] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1
[ 41.450324] option 1-1.5:1.2: GSM modem (1-port) converter detected
[ 41.452242] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB2
[ 41.452665] option 1-1.5:1.3: GSM modem (1-port) converter detected
[ 41.453470] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB3
[ 42.412601] scsi 0:0:0:0: Direct-Access WCDMA MMC Storage 2.31 PQ: 0 ANSI: 2
[ 42.428977] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 42.429125] sd 0:0:0:0: [sda] Attached SCSI removable disk
Bug in usb_modeswitch
Follow
https://bugs.launchpad.net/raspbian/+bug/1593669
to have systemd startup correctly do switch modem
$ ls /etc/usb_modeswitch.d/
05c6:1000
$ cat /etc/usb_modeswitch.d/05c6\:1000
DefaultVendor= 0x05c6
DefaultProduct=0x1000
TargetVendor= 0x05c6
TargetProduct= 0x6000
MessageContent=”5553424312345678000000000000061b000000020000000000000000000000″
StandardEject=1
$ ls -l /dev/ttyUSB*
crw-rw—- 1 root dialout 188, 0 Jun 10 21:55 /dev/ttyUSB0
crw-rw—- 1 root dialout 188, 1 Jun 10 21:55 /dev/ttyUSB1
crw-rw—- 1 root dialout 188, 2 Jun 10 21:55 /dev/ttyUSB2
crw-rw—- 1 root dialout 188, 3 Jun 10 21:55 /dev/ttyUSB3
$ sudo wvdialconf
Editing `/etc/wvdial.conf’.
Scanning your serial ports for a modem.
ttyUSB0: ATQ0 V1 E1 — OK
ttyUSB0: ATQ0 V1 E1 Z — OK
ttyUSB0: ATQ0 V1 E1 S0=0 — OK
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 — OK
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
ttyUSB0: Modem Identifier: ATI — Manufacturer: QUALCOMM INCORPORATED
ttyUSB0: Speed 9600: AT — OK
ttyUSB0: Max speed is 9600; that should be safe.
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
ttyUSB1: ATQ0 V1 E1 — OK
ttyUSB1: ATQ0 V1 E1 Z — OK
ttyUSB1: ATQ0 V1 E1 S0=0 — OK
ttyUSB1: ATQ0 V1 E1 S0=0 &C1 — OK
ttyUSB1: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyUSB1: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
ttyUSB1: Modem Identifier: ATI — Manufacturer: QUALCOMM INCORPORATED
ttyUSB1: Speed 9600: AT — OK
ttyUSB1: Max speed is 9600; that should be safe.
ttyUSB1: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
ttyUSB2: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyUSB2: ATQ0 V1 E1 — failed with 9600 baud, next try: 9600 baud
ttyUSB2: ATQ0 V1 E1 — and failed too at 115200, giving up.
ttyUSB3: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyUSB3: ATQ0 V1 E1 — failed with 9600 baud, next try: 9600 baud
ttyUSB3: ATQ0 V1 E1 — and failed too at 115200, giving up.
Found a modem on /dev/ttyUSB0.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0: Speed 9600; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”
ttyUSB1: Speed 9600; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”
$ sudo apt-get install cu
$ sudo adduser myuser dialout
$ sudo adduser root dialout
$ groups
$ awk -F’:’ ‘/dialout/{print $4}’ /etc/group
to take effect ;-(
$ sudo reboot
$ cu -l /dev/ttyUSB0
And if you cannot see what you type:
$ cu -h -l /dev/ttyUSB1
https://hristoborisov.com/index.php/projects/turning-the-raspberry-pi-into-a-sms-center-using-python/