├── automation-defaults ├── Makefile └── files │ └── automation.defaults ├── bacnet-stack ├── Config-bip.in ├── Config-bip6.in ├── Config-ethernet.in ├── Config-mstp.in ├── Makefile └── files │ ├── bacnet_ai.config │ ├── bacnet_ao.config │ ├── bacnet_av.config │ ├── bacnet_bi.config │ ├── bacnet_bo.config │ ├── bacnet_bv.config │ ├── bacnet_dev.config │ ├── bacnet_group.config │ ├── bacnet_mi.config │ ├── bacnet_mo.config │ ├── bacnet_mv.config │ ├── bacnet_nc.config │ ├── bacnet_tl.config │ ├── bacrouter.init │ ├── bacserv.init │ ├── bacserv_bip.defaults │ ├── bacserv_bip6.defaults │ ├── bacserv_ethernet.defaults │ ├── bacserv_mstp.defaults │ └── bacserv_router.defaults ├── dmx4linux └── Makefile ├── libmbus └── Makefile ├── libpiface └── Makefile ├── libwebsockets └── Makefile ├── linknx-uci ├── Makefile └── files │ ├── etc │ ├── config │ │ └── linknx_mqtt │ └── init.d │ │ └── linknx-uci │ └── usr │ ├── bin │ ├── ets5xml2uci.lua │ ├── linknxhb.lua │ ├── linknxloaddata.lua │ ├── linknxmapper.lua │ ├── linknxreadvalue.lua │ └── linknxwritevalue.lua │ └── sbin │ └── linknxsubsscribemqtt.lua ├── luci-app-bacnet ├── Makefile └── luasrc │ ├── controller │ └── bacnet.lua │ └── model │ └── cbi │ └── bacnet │ ├── bacnet_ai.lua │ ├── bacnet_ao.lua │ ├── bacnet_av.lua │ ├── bacnet_bi.lua │ ├── bacnet_bo.lua │ ├── bacnet_bv.lua │ ├── bacnet_dev.lua │ ├── bacnet_mi.lua │ ├── bacnet_mo.lua │ ├── bacnet_mv.lua │ ├── bacnet_nc.lua │ ├── bacnet_tl.lua │ └── groups.lua ├── luci-app-chat ├── Makefile ├── luasrc │ ├── Makefile │ ├── controller │ │ └── chat.lua │ └── view │ │ └── chat.htm └── luci-static │ └── resources │ └── chat.js ├── luci-app-knxd ├── Makefile ├── files │ └── etc │ │ ├── init.d │ │ └── knxd-ini │ │ └── uci-defaults │ │ └── luci-app-knxd └── luasrc │ ├── controller │ └── knxd.lua │ ├── model │ └── cbi │ │ └── knxd.lua │ └── view │ └── knxd_diag.htm ├── luci-app-linknx ├── Makefile ├── files │ ├── etc │ │ ├── collectd │ │ │ └── conf.d │ │ │ │ └── linknx.conf │ │ └── uci-defaults │ │ │ └── linknx-uci │ └── usr │ │ ├── bin │ │ └── linknx-stat.sh │ │ └── share │ │ └── collectd │ │ └── linknx.db └── luasrc │ ├── controller │ └── linknx.lua │ ├── model │ └── cbi │ │ ├── linknx.lua │ │ └── linknx_xml.lua │ ├── statistics │ └── rrdtool │ │ └── definitions │ │ └── linknx.lua │ └── view │ └── linknx_diag.htm ├── luci-app-modbus ├── Makefile ├── files │ ├── etc │ │ └── icinga │ │ │ └── uci_init.sh │ └── lib │ │ └── nagios │ │ └── plugins │ │ └── notify_via_bacnet.sh └── luasrc │ ├── controller │ └── modbus.lua │ └── model │ └── cbi │ └── modbus.lua ├── mbus-uci ├── Makefile └── files │ ├── mbus-uci.sh │ ├── mbus.config │ ├── mbus.init │ └── xml_parser.sh ├── modbus-uci ├── Makefile ├── files │ ├── modbus.config │ └── modbus.init └── src │ ├── Makefile │ ├── README │ ├── SAIA_Modbus.pdf │ ├── modbus-uci.c │ ├── ucix.c │ └── ucix.h ├── node-homebridge-knx └── Makefile ├── node-homebridge-mpd ├── Makefile └── patches │ └── 000-add-volumen-control.patch ├── node-homebridge-mqtt └── Makefile ├── piface-util ├── Makefile └── src │ ├── Makefile │ ├── Makefile.old │ ├── board_reset.c │ ├── input_reader.c │ └── the_amazing_led_show.c └── ws-mirror-server ├── Makefile ├── files ├── cascade.css ├── chat.js ├── favicon.ico ├── index.html ├── mobile.css └── ws-mirror-server.init └── src ├── Makefile ├── ws-mirror-server-cmd.c ├── ws-mirror-server-ubus.c └── ws-mirror-server.c /automation-defaults/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=automation-defaults 4 | PKG_VERSION:=2018-4-8 5 | PKG_RELEASE:=2 6 | 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 8 | 9 | include $(INCLUDE_DIR)/package.mk 10 | 11 | define Package/automation-defaults 12 | SECTION:=net 13 | CATEGORY:=Network 14 | TITLE:=automation-defaults 15 | endef 16 | 17 | define Build/Prepare 18 | mkdir -p $(PKG_BUILD_DIR) 19 | endef 20 | 21 | define Build/Configure 22 | endef 23 | 24 | define Build/Compile 25 | endef 26 | 27 | define Package/automation-defaults/postinst 28 | #!/bin/sh 29 | 30 | if [ -z $${IPKG_INSTROOT} ] ; then 31 | ( . /etc/uci-defaults/automation ) && rm /etc/uci-defaults/automation 32 | fi 33 | 34 | endef 35 | 36 | define Package/automation-defaults/install 37 | $(INSTALL_DIR) $(1)/etc/uci-defaults 38 | $(INSTALL_BIN) ./files/automation.defaults $(1)/etc/uci-defaults/zautomation 39 | endef 40 | 41 | $(eval $(call BuildPackage,automation-defaults)) 42 | -------------------------------------------------------------------------------- /automation-defaults/files/automation.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | 5 | setup_system() { 6 | local cfg=$1 7 | config_get hostname $cfg hostname 8 | if [ -z "$hostname" ] || [ "$hostname" == "OpenWrt" ] || [ "$hostname" == "LEDE" ]; then 9 | # Set Hostname 10 | rand="$(echo -n $(head -n 1 /dev/urandom 2>/dev/null | md5sum | cut -b 1-4))" 11 | rand="$(printf "%d" "0x$rand")" 12 | hostname="$hostname-$rand" 13 | uci_set system $cfg hostname "$hostname" 14 | uci_set system $cfg hostname_rand "$rand" 15 | echo $hostname > /proc/sys/kernel/hostname 16 | # Set Timezone 17 | uci_set system $cfg zonename "Europe/Berlin" 18 | uci_set system $cfg timezone "CET-1CEST,M3.5.0,M10.5.0/3" 19 | uci_set network lan proto "dhcp" 20 | uci_set network lan delegate "0" 21 | uci_add network interface lan6 22 | uci_set network lan6 ifname "@lan" 23 | uci_set network lan6 proto "dhcpv6" 24 | uci_set network lan6 reqaddress "try" 25 | uci_set network lan6 reqprefix "no" 26 | # set multcast route to lan for knx ip 27 | uci_add network route knxmcast 28 | uci_set network knxmcast gateway "0.0.0.0" 29 | uci_set network knxmcast interface "lan" 30 | uci_set network knxmcast target "224.0.23.12" 31 | uci_set dhcp lan ignore 1 32 | uci_set dhcp @dnsmasq[0] rebind_protection "0" 33 | uci_set dhcp lan dhcpv6 "disabled" 34 | uci_set dhcp lan ra "disabled" 35 | uci_set firewall @zone[0] network "lan lan6" 36 | fi 37 | } 38 | 39 | #Load dhcp config 40 | config_load system 41 | #Setup system hostname,timezone,location,latlon 42 | config_foreach setup_system system 43 | 44 | #Save 45 | uci_commit system 46 | uci_commit network 47 | uci_commit dhcp 48 | -------------------------------------------------------------------------------- /bacnet-stack/Config-bip.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_bacnet-stack-bip 2 | 3 | config BACNET_STACK_BIP_AI 4 | bool "Enable Analog Input Object" 5 | default y 6 | 7 | config BACNET_STACK_BIP_AI_MAX 8 | string 9 | prompt "Max Analog Input Object" 10 | default "512" 11 | 12 | config BACNET_STACK_BIP_AO 13 | bool "Enable Analog Output Object" 14 | default y 15 | 16 | config BACNET_STACK_BIP_AO_MAX 17 | string 18 | prompt "Max Analog Output Object" 19 | default "512" 20 | 21 | config BACNET_STACK_BIP_AV 22 | bool "Enable Analog Value Object" 23 | default y 24 | 25 | config BACNET_STACK_BIP_AV_MAX 26 | string 27 | prompt "Max Analog Value Object" 28 | default "512" 29 | 30 | config BACNET_STACK_BIP_BI 31 | bool "Enable Binary Input Object" 32 | default y 33 | 34 | config BACNET_STACK_BIP_BI_MAX 35 | string 36 | prompt "Max Binary Input Object" 37 | default "512" 38 | 39 | config BACNET_STACK_BIP_BO 40 | bool "Enable Binary Output Object" 41 | default y 42 | 43 | config BACNET_STACK_BIP_BO_MAX 44 | string 45 | prompt "Max Binary Output Object" 46 | default "512" 47 | 48 | config BACNET_STACK_BIP_BV 49 | bool "Enable Binary Value Object" 50 | default y 51 | 52 | config BACNET_STACK_BIP_BV_MAX 53 | string 54 | prompt "Max Binary Value Object" 55 | default "512" 56 | 57 | config BACNET_STACK_BIP_MSI 58 | bool "Enable Multistate Input Object" 59 | default y 60 | 61 | config BACNET_STACK_BIP_MSI_MAX 62 | string 63 | prompt "Max Multistate Input Object" 64 | default "512" 65 | 66 | config BACNET_STACK_BIP_MSO 67 | bool "Enable Multistate Output Object" 68 | default y 69 | 70 | config BACNET_STACK_BIP_MSO_MAX 71 | string 72 | prompt "Max Multistate Output Object" 73 | default "512" 74 | 75 | config BACNET_STACK_BIP_MSV 76 | bool "Enable Multistate Value Object" 77 | default y 78 | 79 | config BACNET_STACK_BIP_MSV_MAX 80 | string 81 | prompt "Max Multistate Value Object" 82 | default "512" 83 | 84 | config BACNET_STACK_BIP_NC 85 | bool "Enable Intrinsic Reporting" 86 | default y 87 | 88 | config BACNET_STACK_BIP_NC_MAX 89 | string 90 | prompt "Max Notification Classes" 91 | default "16" 92 | 93 | config BACNET_STACK_BIP_TRENDLOG 94 | bool "Enable Trendlog Object" 95 | default y 96 | 97 | config BACNET_STACK_BIP_TRENDLOG_MAX 98 | string 99 | prompt "Max Trendlog Object" 100 | default "16" 101 | 102 | config BACNET_STACK_BIP_FILE 103 | bool "Enable File Object" 104 | default n 105 | 106 | config BACNET_STACK_BIP_TIME 107 | bool "Enable Time Master" 108 | default y 109 | 110 | config BACNET_STACK_BIP_BBMD 111 | bool "Enable BBMD" 112 | default y 113 | 114 | config BACNET_STACK_BIP_BBMD_CLIENT 115 | bool "Enable BBMD Client" 116 | default n 117 | 118 | endif 119 | -------------------------------------------------------------------------------- /bacnet-stack/Config-bip6.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_bacnet-stack-bip6 2 | 3 | config BACNET_STACK_BIP6_AI 4 | bool "Enable Analog Input Object" 5 | default y 6 | 7 | config BACNET_STACK_BIP6_AI_MAX 8 | string 9 | prompt "Max Analog Input Object" 10 | default "512" 11 | 12 | config BACNET_STACK_BIP6_AO 13 | bool "Enable Analog Output Object" 14 | default y 15 | 16 | config BACNET_STACK_BIP6_AO_MAX 17 | string 18 | prompt "Max Analog Output Object" 19 | default "512" 20 | 21 | config BACNET_STACK_BIP6_AV 22 | bool "Enable Analog Value Object" 23 | default y 24 | 25 | config BACNET_STACK_BIP6_AV_MAX 26 | string 27 | prompt "Max Analog Value Object" 28 | default "512" 29 | 30 | config BACNET_STACK_BIP6_BI 31 | bool "Enable Binary Input Object" 32 | default y 33 | 34 | config BACNET_STACK_BIP6_BI_MAX 35 | string 36 | prompt "Max Binary Input Object" 37 | default "512" 38 | 39 | config BACNET_STACK_BIP6_BO 40 | bool "Enable Binary Output Object" 41 | default y 42 | 43 | config BACNET_STACK_BIP6_BO_MAX 44 | string 45 | prompt "Max Binary Output Object" 46 | default "512" 47 | 48 | config BACNET_STACK_BIP6_BV 49 | bool "Enable Binary Value Object" 50 | default y 51 | 52 | config BACNET_STACK_BIP6_BV_MAX 53 | string 54 | prompt "Max Binary Value Object" 55 | default "512" 56 | 57 | config BACNET_STACK_BIP6_MSI 58 | bool "Enable Multistate Input Object" 59 | default y 60 | 61 | config BACNET_STACK_BIP6_MSI_MAX 62 | string 63 | prompt "Max Multistate Input Object" 64 | default "512" 65 | 66 | config BACNET_STACK_BIP6_MSO 67 | bool "Enable Multistate Output Object" 68 | default y 69 | 70 | config BACNET_STACK_BIP6_MSO_MAX 71 | string 72 | prompt "Max Multistate Output Object" 73 | default "512" 74 | 75 | config BACNET_STACK_BIP6_MSV 76 | bool "Enable Multistate Value Object" 77 | default y 78 | 79 | config BACNET_STACK_BIP6_MSV_MAX 80 | string 81 | prompt "Max Multistate Value Object" 82 | default "512" 83 | 84 | config BACNET_STACK_BIP6_NC 85 | bool "Enable Intrinsic Reporting" 86 | default y 87 | 88 | config BACNET_STACK_BIP6_NC_MAX 89 | string 90 | prompt "Max Notification Classes" 91 | default "16" 92 | 93 | config BACNET_STACK_BIP6_TRENDLOG 94 | bool "Enable Trendlog Object" 95 | default y 96 | 97 | config BACNET_STACK_BIP6_TRENDLOG_MAX 98 | string 99 | prompt "Max Trendlog Object" 100 | default "16" 101 | 102 | config BACNET_STACK_BIP6_FILE 103 | bool "Enable File Object" 104 | default n 105 | 106 | config BACNET_STACK_BIP6_TIME 107 | bool "Enable Time Master" 108 | default y 109 | 110 | config BACNET_STACK_BIP6_BBMD 111 | bool "Enable BBMD" 112 | default y 113 | 114 | config BACNET_STACK_BIP6_BBMD_CLIENT 115 | bool "Enable BBMD Client" 116 | default n 117 | 118 | endif 119 | -------------------------------------------------------------------------------- /bacnet-stack/Config-ethernet.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_bacnet-stack-ethernet 2 | 3 | config BACNET_STACK_ETHERNET_AI 4 | bool "Enable Analog Input Object" 5 | default y 6 | 7 | config BACNET_STACK_ETHERNET_AI_MAX 8 | string 9 | prompt "Max Analog Input Object" 10 | default "512" 11 | 12 | config BACNET_STACK_ETHERNET_AO 13 | bool "Enable Analog Output Object" 14 | default y 15 | 16 | config BACNET_STACK_ETHERNET_AO_MAX 17 | string 18 | prompt "Max Analog Output Object" 19 | default "512" 20 | 21 | config BACNET_STACK_ETHERNET_AV 22 | bool "Enable Analog Value Object" 23 | default y 24 | 25 | config BACNET_STACK_ETHERNET_AV_MAX 26 | string 27 | prompt "Max Analog Value Object" 28 | default "512" 29 | 30 | config BACNET_STACK_ETHERNET_BI 31 | bool "Enable Binary Input Object" 32 | default y 33 | 34 | config BACNET_STACK_ETHERNET_BI_MAX 35 | string 36 | prompt "Max Binary Input Object" 37 | default "512" 38 | 39 | config BACNET_STACK_ETHERNET_BO 40 | bool "Enable Binary Output Object" 41 | default y 42 | 43 | config BACNET_STACK_ETHERNET_BO_MAX 44 | string 45 | prompt "Max Binary Output Object" 46 | default "512" 47 | 48 | config BACNET_STACK_ETHERNET_BV 49 | bool "Enable Binary Value Object" 50 | default y 51 | 52 | config BACNET_STACK_ETHERNET_BV_MAX 53 | string 54 | prompt "Max Binary Value Object" 55 | default "512" 56 | 57 | config BACNET_STACK_ETHERNET_MSI 58 | bool "Enable Multistate Input Object" 59 | default y 60 | 61 | config BACNET_STACK_ETHERNET_MSI_MAX 62 | string 63 | prompt "Max Multistate Input Object" 64 | default "512" 65 | 66 | config BACNET_STACK_ETHERNET_MSO 67 | bool "Enable Multistate Output Object" 68 | default y 69 | 70 | config BACNET_STACK_ETHERNET_MSO_MAX 71 | string 72 | prompt "Max Multistate Output Object" 73 | default "512" 74 | 75 | config BACNET_STACK_ETHERNET_MSV 76 | bool "Enable Multistate Value Object" 77 | default y 78 | 79 | config BACNET_STACK_ETHERNET_MSV_MAX 80 | string 81 | prompt "Max Multistate Value Object" 82 | default "512" 83 | 84 | config BACNET_STACK_ETHERNET_NC 85 | bool "Enable Intrinsic Reporting" 86 | default y 87 | 88 | config BACNET_STACK_ETHERNET_NC_MAX 89 | string 90 | prompt "Max Notification Classes" 91 | default "16" 92 | 93 | config BACNET_STACK_ETHERNET_TRENDLOG 94 | bool "Enable Trendlog Object" 95 | default y 96 | 97 | config BACNET_STACK_ETHERNET_TRENDLOG_MAX 98 | string 99 | prompt "Max Trendlog Object" 100 | default "16" 101 | 102 | config BACNET_STACK_ETHERNET_FILE 103 | bool "Enable File Object" 104 | default n 105 | 106 | config BACNET_STACK_ETHERNET_TIME 107 | bool "Enable Time Master" 108 | default y 109 | 110 | config BACNET_STACK_ETHERNET_BBMD 111 | bool "Enable BBMD" 112 | default y 113 | 114 | config BACNET_STACK_ETHERNET_BBMD_CLIENT 115 | bool "Enable BBMD Client" 116 | default n 117 | 118 | endif 119 | -------------------------------------------------------------------------------- /bacnet-stack/Config-mstp.in: -------------------------------------------------------------------------------- 1 | if PACKAGE_bacnet-stack-mstp 2 | 3 | config BACNET_STACK_MSTP_AI 4 | bool "Enable Analog Input Object" 5 | default y 6 | 7 | config BACNET_STACK_MSTP_AI_MAX 8 | string 9 | prompt "Max Analog Input Object" 10 | default "512" 11 | 12 | config BACNET_STACK_MSTP_AO 13 | bool "Enable Analog Output Object" 14 | default y 15 | 16 | config BACNET_STACK_MSTP_AO_MAX 17 | string 18 | prompt "Max Analog Output Object" 19 | default "512" 20 | 21 | config BACNET_STACK_MSTP_AV 22 | bool "Enable Analog Value Object" 23 | default y 24 | 25 | config BACNET_STACK_MSTP_AV_MAX 26 | string 27 | prompt "Max Analog Value Object" 28 | default "512" 29 | 30 | config BACNET_STACK_MSTP_BI 31 | bool "Enable Binary Input Object" 32 | default y 33 | 34 | config BACNET_STACK_MSTP_BI_MAX 35 | string 36 | prompt "Max Binary Input Object" 37 | default "512" 38 | 39 | config BACNET_STACK_MSTP_BO 40 | bool "Enable Binary Output Object" 41 | default y 42 | 43 | config BACNET_STACK_MSTP_BO_MAX 44 | string 45 | prompt "Max Binary Output Object" 46 | default "512" 47 | 48 | config BACNET_STACK_MSTP_BV 49 | bool "Enable Binary Value Object" 50 | default y 51 | 52 | config BACNET_STACK_MSTP_BV_MAX 53 | string 54 | prompt "Max Binary Value Object" 55 | default "512" 56 | 57 | config BACNET_STACK_MSTP_MSI 58 | bool "Enable Multistate Input Object" 59 | default y 60 | 61 | config BACNET_STACK_MSTP_MSI_MAX 62 | string 63 | prompt "Max Multistate Input Object" 64 | default "512" 65 | 66 | config BACNET_STACK_MSTP_MSO 67 | bool "Enable Multistate Output Object" 68 | default y 69 | 70 | config BACNET_STACK_MSTP_MSO_MAX 71 | string 72 | prompt "Max Multistate Output Object" 73 | default "512" 74 | 75 | config BACNET_STACK_MSTP_MSV 76 | bool "Enable Multistate Value Object" 77 | default y 78 | 79 | config BACNET_STACK_MSTP_MSV_MAX 80 | string 81 | prompt "Max Multistate Value Object" 82 | default "512" 83 | 84 | config BACNET_STACK_MSTP_NC 85 | bool "Enable Intrinsic Reporting" 86 | default y 87 | 88 | config BACNET_STACK_MSTP_NC_MAX 89 | string 90 | prompt "Max Notification Classes" 91 | default "16" 92 | 93 | config BACNET_STACK_MSTP_TRENDLOG 94 | bool "Enable Trendlog Object" 95 | default y 96 | 97 | config BACNET_STACK_MSTP_TRENDLOG_MAX 98 | string 99 | prompt "Max Trendlog Object" 100 | default "16" 101 | 102 | config BACNET_STACK_MSTP_FILE 103 | bool "Enable File Object" 104 | default n 105 | 106 | config BACNET_STACK_MSTP_TIME 107 | bool "Enable Time Master" 108 | default y 109 | 110 | config BACNET_STACK_MSTP_BBMD 111 | bool "Enable BBMD" 112 | default n 113 | 114 | config BACNET_STACK_MSTP_BBMD_CLIENT 115 | bool "Enable BBMD Client" 116 | default n 117 | 118 | endif 119 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_ai.config: -------------------------------------------------------------------------------- 1 | 2 | config ai 'default' 3 | option si_unit '98' 4 | option value '23' 5 | option description 'Analog Input' 6 | option nc '1' 7 | option event '7' 8 | option limit '3' 9 | option high_limit '100' 10 | option low_limit '0' 11 | option dead_limit '0' 12 | option cov_increment '0.1' 13 | option max_value '100' 14 | option min_value '0' 15 | 16 | config ai '0' 17 | option pgroup 'R802' 18 | option name 'AI_00' 19 | option description 'Stromzaehler' 20 | option addr '0' 21 | option tagname 'mbus-s3' 22 | option unit_id '1' 23 | option si_unit '18' 24 | option value '0.000000' 25 | option value_time '1521886635' 26 | option Out_Of_Service '1' 27 | 28 | config ai '1' 29 | option pgroup 'R301' 30 | option name 'R301_Temperatur_Raum' 31 | option description 'Raumtemperatur' 32 | option addr '0/0/14' 33 | option tagname 'linknx' 34 | option dpt '9.xxx' 35 | option si_unit '62' 36 | option value '0' 37 | option value_time '0' 38 | option Out_Of_Service '0' 39 | 40 | config ai '2' 41 | option pgroup 'R802' 42 | option name 'AI_02' 43 | option description 'Raumtemperatur' 44 | option addr '2' 45 | option tagname 'modbus-s1' 46 | option si_unit '62' 47 | option value '0.000000' 48 | option value_time '1521886635' 49 | option Out_Of_Service '1' 50 | 51 | config ai '3' 52 | option pgroup 'R802' 53 | option name 'AI_03' 54 | option description 'Raumtemperatur' 55 | option addr '3' 56 | option tagname 'modbus-s1' 57 | option si_unit '62' 58 | option value '0.000000' 59 | option value_time '0' 60 | option Out_Of_Service '1' 61 | 62 | config ai '4' 63 | option pgroup 'R802' 64 | option name 'AI_04' 65 | option description 'Raumtemperatur' 66 | option addr '0' 67 | option tagname 'modbus-s2' 68 | option si_unit '62' 69 | option value_time '1521886637' 70 | option value '55.000000' 71 | option Out_Of_Service '1' 72 | 73 | config ai '5' 74 | option pgroup 'R802' 75 | option name 'AI_05' 76 | option description 'Raumtemperatur' 77 | option addr '1' 78 | option tagname 'modbus-s2' 79 | option si_unit '62' 80 | option value_time '1521886637' 81 | option value '66.000000' 82 | option Out_Of_Service '1' 83 | 84 | config ai '6' 85 | option pgroup 'R802' 86 | option name 'AI_06' 87 | option description 'Raumtemperatur' 88 | option addr '2' 89 | option tagname 'modbus-s2' 90 | option si_unit '62' 91 | option value_time '1521886637' 92 | option value '77.000000' 93 | option Out_Of_Service '1' 94 | 95 | config ai '7' 96 | option pgroup 'R802' 97 | option name 'AI_07' 98 | option description 'Raumtemperatur' 99 | option addr '3' 100 | option tagname 'modbus-s2' 101 | option si_unit '62' 102 | option value_time '1521886638' 103 | option value '88.000000' 104 | option Out_Of_Service '1' 105 | 106 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_ao.config: -------------------------------------------------------------------------------- 1 | 2 | config ao 'default' 3 | option si_unit '98' 4 | option description 'Analog Value' 5 | option nc '1' 6 | option event '7' 7 | option limit '0' 8 | option high_limit '100' 9 | option low_limit '0' 10 | option dead_limit '0' 11 | option cov_increment '0.1' 12 | option max_value '100' 13 | option min_value '0' 14 | 15 | config ao '0' 16 | option pgroup 'R802' 17 | option name 'R801_HZ_Y' 18 | option description 'Heizventil' 19 | option addr '11' 20 | option tagname 'modbus-s1' 21 | option resolution '0.1' 22 | option dead_limit '0.5' 23 | option cov_increment '0.2' 24 | option value '0.000000' 25 | 26 | config ao '1' 27 | option pgroup 'R802' 28 | option name 'R802_HZ_Y' 29 | option description 'Heizventil' 30 | option addr '12' 31 | option tagname 'modbus-s1' 32 | option resolution '0.1' 33 | option value '0.000000' 34 | 35 | config ao '2' 36 | option pgroup 'R301' 37 | option name 'R301_DL_HW' 38 | option description 'Deckenleuchte Helligkeitswert' 39 | option addr '0/0/2' 40 | option tagname 'linknx' 41 | option resolution '0.1' 42 | option dead_limit '0.5' 43 | option cov_increment '0.2' 44 | option dpt '5.001' 45 | option Out_Of_Service '0' 46 | option fb_value '0' 47 | option value '0' 48 | option value_time '0' 49 | 50 | config ao '3' 51 | option pgroup 'R301' 52 | option name 'R301_Ventil_Heizen' 53 | option description 'Heizventil' 54 | option addr '0/0/11' 55 | option tagname 'linknx' 56 | option resolution '0.1' 57 | option dead_limit '0.5' 58 | option cov_increment '0.2' 59 | option dpt '5.001' 60 | option Out_Of_Service '0' 61 | option fb_value '0' 62 | option value '0' 63 | option value_time '0' 64 | 65 | config ao '4' 66 | option pgroup 'R301' 67 | option name 'R301_Ventil_Kuehlen' 68 | option description 'Kuehlventil' 69 | option addr '0/0/12' 70 | option tagname 'linknx' 71 | option resolution '0.1' 72 | option dead_limit '0.5' 73 | option cov_increment '0.2' 74 | option dpt '5.001' 75 | option Out_Of_Service '0' 76 | option fb_value '0' 77 | option value '0' 78 | option value_time '0' 79 | 80 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_av.config: -------------------------------------------------------------------------------- 1 | 2 | config av 'default' 3 | option si_unit '98' 4 | option description 'Analog Value' 5 | option nc '1' 6 | option event '7' 7 | option limit '3' 8 | option high_limit '40' 9 | option low_limit '0' 10 | option dead_limit '0' 11 | option cov_increment '0.1' 12 | option max_value '100' 13 | option min_value '0' 14 | 15 | config av '0' 16 | option pgroup 'R801' 17 | option name 'R801_RT' 18 | option description 'Raumtemperatur' 19 | option addr '0' 20 | option tagname 'modbus-s1' 21 | option si_unit '62' 22 | option dead_limit '0.5' 23 | option cov_increment '0.2' 24 | option resolution '0.1' 25 | option value '300.000000' 26 | option value_time '1521885295' 27 | option Out_Of_Service '1' 28 | 29 | config av '1' 30 | option pgroup 'R301' 31 | option name 'R301_Temperatur_Sollwert' 32 | option description 'Raumtemperatur Sollwert berrechnet' 33 | option tagname 'linknx' 34 | option si_unit '62' 35 | option resolution '0.1' 36 | option addr '0/0/10' 37 | option value '23' 38 | option value_time '0' 39 | option Out_Of_Service '0' 40 | 41 | config av '2' 42 | option pgroup 'R901' 43 | option name 'R901_RT' 44 | option description 'Raumtemperatur' 45 | option addr '2' 46 | option tagname 'modbus-s1' 47 | option si_unit '62' 48 | option dead_limit '0.5' 49 | option cov_increment '0.2' 50 | option resolution 'doublefloat' 51 | option value '0.000000' 52 | option value_time '1521885220' 53 | option Out_Of_Service '1' 54 | 55 | config av '3' 56 | option pgroup 'R902' 57 | option name 'R902_RT' 58 | option description 'Raumtemperatur' 59 | option tagname 'modbus-s1' 60 | option si_unit '62' 61 | option resolution '0.1' 62 | option addr '3' 63 | option value '32.100002' 64 | option value_time '1521886193' 65 | option Out_Of_Service '1' 66 | 67 | config av '4' 68 | option pgroup 'R810' 69 | option name 'dword1' 70 | option description 'Datenwort 1 16Bit' 71 | option tagname 'modbus-s1' 72 | option si_unit '61' 73 | option resolution '1' 74 | option addr '4' 75 | option cov_increment '1' 76 | option value '22.000000' 77 | option value_time '1521886154' 78 | option Out_Of_Service '1' 79 | 80 | config av '5' 81 | option pgroup 'R810' 82 | option name 'R810_RT' 83 | option description 'Raumtemperatur' 84 | option addr '0' 85 | option tagname 'modbus-s2' 86 | option si_unit '62' 87 | option dead_limit '0.5' 88 | option cov_increment '0.2' 89 | option resolution '0.1' 90 | option value '0.000000' 91 | option value_time '1521886222' 92 | option Out_Of_Service '1' 93 | 94 | config av '6' 95 | option pgroup 'R811' 96 | option name 'R811_RT' 97 | option description 'Raumtemperatur' 98 | option tagname 'modbus-s2' 99 | option si_unit '62' 100 | option resolution '0.1' 101 | option addr '1' 102 | option value '123.400002' 103 | option value_time '1521886149' 104 | option Out_Of_Service '1' 105 | 106 | config av '7' 107 | option pgroup 'R910' 108 | option name 'R910_RT' 109 | option description 'Raumtemperatur' 110 | option addr '2' 111 | option tagname 'modbus-s2' 112 | option si_unit '62' 113 | option dead_limit '0.5' 114 | option cov_increment '0.2' 115 | option resolution 'doublefloat' 116 | option value '0.000000' 117 | option value_time '1521886211' 118 | option Out_Of_Service '1' 119 | 120 | config av '8' 121 | option pgroup 'R911' 122 | option name 'R911_RT' 123 | option description 'Raumtemperatur' 124 | option tagname 'modbus-s2' 125 | option si_unit '62' 126 | option resolution '0.1' 127 | option addr '3' 128 | option value '2.200000' 129 | option value_time '1521886002' 130 | option Out_Of_Service '1' 131 | 132 | config av '9' 133 | option pgroup 'R911' 134 | option name 'dword2' 135 | option description 'Datenwort 2 16Bit' 136 | option tagname 'modbus-s2' 137 | option si_unit '61' 138 | option resolution '1' 139 | option addr '4' 140 | option cov_increment '1' 141 | option value_time '1521885331' 142 | option value '555.000000' 143 | option Out_Of_Service '1' 144 | 145 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_bi.config: -------------------------------------------------------------------------------- 1 | 2 | config bi 'default' 3 | option description 'Binary Input' 4 | option inactive 'AUS' 5 | option active 'EIN' 6 | option nc '1' 7 | option event '7' 8 | option time_delay '3' 9 | 10 | config bi '0' 11 | option name 'BI_00' 12 | option alarm_value '0' 13 | option tagname 'modbus-s1' 14 | option addr '4' 15 | option bit '0' 16 | option resolution 'dword' 17 | option active 'Ein' 18 | option inactive 'Aus' 19 | option description 'Datenwort 1 Bit 0' 20 | option value '0' 21 | 22 | config bi '1' 23 | option name 'BI_01' 24 | option alarm_value '0' 25 | option tagname 'modbus-s1' 26 | option addr '4' 27 | option bit '1' 28 | option resolution 'dword' 29 | option active 'Ein' 30 | option inactive 'Aus' 31 | option description 'Datenwort 1 Bit 1' 32 | option Out_Of_Service '0' 33 | option value '0' 34 | 35 | config bi '2' 36 | option name 'BI_02' 37 | option description 'Datenwort 1 Bit 2' 38 | option alarm_value '1' 39 | option bit '2' 40 | option tagname 'modbus-s1' 41 | option resolution 'dword' 42 | option addr '4' 43 | option active 'Ein' 44 | option inactive 'Aus' 45 | option value '0' 46 | 47 | config bi '3' 48 | option name 'BI_03' 49 | option description 'Datenwort 1 Bit 3' 50 | option alarm_value '1' 51 | option bit '3' 52 | option tagname 'modbus-s1' 53 | option resolution 'dword' 54 | option addr '4' 55 | option active 'Ein' 56 | option inactive 'Aus' 57 | option value '0' 58 | 59 | config bi '4' 60 | option name 'BI_04' 61 | option description 'Datenwort 1 Bit 4' 62 | option alarm_value '1' 63 | option bit '4' 64 | option tagname 'modbus-s1' 65 | option resolution 'dword' 66 | option addr '4' 67 | option active 'Ein' 68 | option inactive 'Aus' 69 | option value '0' 70 | 71 | config bi '5' 72 | option name 'BI_05' 73 | option description 'Datenwort 1 Bit 5' 74 | option alarm_value '1' 75 | option bit '5' 76 | option tagname 'modbus-s1' 77 | option resolution 'dword' 78 | option addr '4' 79 | option active 'Ein' 80 | option inactive 'Aus' 81 | option value '0' 82 | 83 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_bo.config: -------------------------------------------------------------------------------- 1 | 2 | config bo 'default' 3 | option description 'Binary Output' 4 | option inactive 'AUS' 5 | option active 'EIN' 6 | option nc '1' 7 | option event '7' 8 | option time_delay '3' 9 | 10 | config bo '0' 11 | option name 'BO_00' 12 | option tagname 'modbus-s1' 13 | option addr '5' 14 | option bit '0' 15 | option resolution 'dword' 16 | option active 'Ein' 17 | option inactive 'Aus' 18 | option description 'Datenwort 2 Bit 0' 19 | option value '0' 20 | option fb_value '0' 21 | 22 | config bo '1' 23 | option pgroup 'R301' 24 | option name 'R301_DL_EA' 25 | option description 'Deckenleuchte Ein/Aus' 26 | option addr '0/0/1' 27 | option active 'Ein' 28 | option inactive 'Aus' 29 | option Out_Of_Service '0' 30 | option tagname 'linknx' 31 | option dpt '1.001' 32 | option fb_value '1' 33 | option value '1' 34 | option value_time '0' 35 | 36 | config bo '2' 37 | option name 'BO_02' 38 | option description 'Datenwort 2 Bit 2' 39 | option bit '2' 40 | option tagname 'modbus-s1' 41 | option resolution 'dword' 42 | option addr '5' 43 | option active 'Ein' 44 | option inactive 'Aus' 45 | option value '0' 46 | option fb_value '0' 47 | 48 | config bo '3' 49 | option name 'BO_03' 50 | option description 'Datenwort 2 Bit 3' 51 | option bit '3' 52 | option tagname 'modbus-s1' 53 | option resolution 'dword' 54 | option addr '5' 55 | option value '0' 56 | option active 'Ein' 57 | option inactive 'Aus' 58 | option fb_value '0' 59 | 60 | config bo '4' 61 | option name 'BO_04' 62 | option description 'Datenwort 2 Bit 4' 63 | option bit '4' 64 | option tagname 'modbus-s1' 65 | option resolution 'dword' 66 | option addr '5' 67 | option active 'Ein' 68 | option inactive 'Aus' 69 | option value '0' 70 | option fb_value '0' 71 | 72 | config bo '5' 73 | option name 'BO_05' 74 | option description 'Datenwort 2 Bit 5' 75 | option bit '5' 76 | option tagname 'modbus-s1' 77 | option resolution 'dword' 78 | option addr '5' 79 | option active 'Ein' 80 | option inactive 'Aus' 81 | option value '0' 82 | option fb_value '0' 83 | 84 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_bv.config: -------------------------------------------------------------------------------- 1 | 2 | config bv 'default' 3 | option description 'Binary Value' 4 | option inactive 'AUS' 5 | option active 'EIN' 6 | option nc '1' 7 | option event '7' 8 | option time_delay '3' 9 | 10 | config bv '0' 11 | option name 'BV_00' 12 | option alarm_value '0' 13 | option tagname 'modbus-s1' 14 | option addr '5' 15 | option bit '0' 16 | option resolution 'dword' 17 | option active 'Ein' 18 | option inactive 'Aus' 19 | option description 'Datenwort 2 Bit 0' 20 | option value '0' 21 | 22 | config bv '1' 23 | option name 'BV_01' 24 | option alarm_value '0' 25 | option tagname 'modbus-s1' 26 | option addr '5' 27 | option bit '1' 28 | option resolution 'dword' 29 | option active 'Ein' 30 | option inactive 'Aus' 31 | option description 'Datenwort 2 Bit 1' 32 | option value '0' 33 | 34 | config bv '2' 35 | option name 'BV_02' 36 | option description 'Datenwort 2 Bit 2' 37 | option alarm_value '1' 38 | option bit '2' 39 | option tagname 'modbus-s1' 40 | option resolution 'dword' 41 | option addr '5' 42 | option active 'Ein' 43 | option inactive 'Aus' 44 | option value '0' 45 | 46 | config bv '3' 47 | option name 'BV_03' 48 | option description 'Datenwort 2 Bit 3' 49 | option alarm_value '1' 50 | option bit '3' 51 | option tagname 'modbus-s1' 52 | option resolution 'dword' 53 | option addr '5' 54 | option value '0' 55 | option active 'Ein' 56 | option inactive 'Aus' 57 | 58 | config bv '4' 59 | option name 'BV_04' 60 | option description 'Datenwort 2 Bit 4' 61 | option alarm_value '1' 62 | option bit '4' 63 | option tagname 'modbus-s1' 64 | option resolution 'dword' 65 | option addr '5' 66 | option active 'Ein' 67 | option inactive 'Aus' 68 | option value '0' 69 | 70 | config bv '5' 71 | option name 'BV_05' 72 | option description 'Datenwort 2 Bit 5' 73 | option alarm_value '1' 74 | option bit '5' 75 | option tagname 'modbus-s1' 76 | option resolution 'dword' 77 | option addr '5' 78 | option active 'Ein' 79 | option inactive 'Aus' 80 | option value '0' 81 | 82 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_dev.config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stargieg/packages-automation/22fed364225ae4bd51364a0e96d52f74df40b198/bacnet-stack/files/bacnet_dev.config -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_group.config: -------------------------------------------------------------------------------- 1 | config 'main' 2 | option 'name' 'Project Name' 3 | option 'comment' 'Project Comment' 4 | 5 | 6 | config 'group' 'R301' 7 | option 'pgroup' 'OG3' 8 | option 'name' 'R301' 9 | option 'ignore' '0' 10 | option 'comment' 'FLUR' 11 | option 'groupexpr' 'R801' 12 | option 'img' '/lib/uci/upload/cbid.bacnet_group.R301.img' 13 | 14 | config 'group' 'OG8' 15 | option 'name' 'OG8' 16 | option 'ignore' '0' 17 | option 'groupexpr' 'OG8' 18 | option 'comment' '8. OBERGESCHOSS' 19 | option 'img' '/lib/uci/upload/cbid.bacnet_group.OG8.img' 20 | 21 | config 'group' 'R801' 22 | option 'pgroup' 'OG8' 23 | option 'name' 'R801' 24 | option 'ignore' '0' 25 | option 'comment' 'FLUR' 26 | option 'groupexpr' 'R801' 27 | option 'img' '/lib/uci/upload/cbid.bacnet_group.R801.img' 28 | 29 | config 'group' 'R802' 30 | option 'pgroup' 'OG8' 31 | option 'name' 'R802' 32 | option 'ignore' '0' 33 | option 'comment' 'Buero1' 34 | option 'groupexpr' 'R802' 35 | option 'img' '/lib/uci/upload/cbid.bacnet_group.R802.img' 36 | 37 | config 'group' 'OG9' 38 | option 'name' 'OG9' 39 | option 'ignore' '0' 40 | option 'groupexpr' 'OG9' 41 | option 'comment' '9. OBERGESCHOSS' 42 | option 'img' '/lib/uci/upload/cbid.bacnet_group.OG9.img' 43 | 44 | config 'group' 'R901' 45 | option 'pgroup' 'OG9' 46 | option 'name' 'R901' 47 | option 'ignore' '0' 48 | option 'comment' 'FLUR' 49 | option 'groupexpr' 'R901' 50 | option 'img' '/lib/uci/upload/cbid.bacnet_group.R901.img' 51 | 52 | config 'group' 'R902' 53 | option 'pgroup' 'OG9' 54 | option 'name' 'R902' 55 | option 'ignore' '0' 56 | option 'comment' 'Buero1' 57 | option 'groupexpr' 'R902' 58 | option 'img' '/lib/uci/upload/cbid.bacnet_group.R902.img' 59 | 60 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_mi.config: -------------------------------------------------------------------------------- 1 | config mi 'default' 2 | list state 'up' 3 | list state 'down' 4 | list state 'unreachable' 5 | list state 'flaping' 6 | list alarmstate 'down' 7 | list alarmstate 'unreachable' 8 | list alarmstate 'flaping' 9 | option description 'Multi State Input' 10 | option nc '1' 11 | option event '7' 12 | 13 | config mi '0' 14 | option name 'TR_EZR00_SV01_IN' 15 | option value '1' 16 | option description '192.168.100.29' 17 | 18 | config mi '1' 19 | option name 'TR_EZR01_SV01_IN' 20 | option value '1' 21 | option description '192.168.100.30' 22 | 23 | config mi '2' 24 | option name 'TR_EZR02_SV01_IN' 25 | option value '1' 26 | option description '192.168.100.32' 27 | 28 | config mi '3' 29 | option name 'TR_EZR02_SV02_IN' 30 | option value '1' 31 | option description '192.168.100.33' 32 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_mo.config: -------------------------------------------------------------------------------- 1 | config mo 'default' 2 | list state 'up' 3 | list state 'down' 4 | list state 'unreachable' 5 | list state 'flaping' 6 | list alarmstate 'down' 7 | list alarmstate 'unreachable' 8 | list alarmstate 'flaping' 9 | option description 'Multi State Output' 10 | option nc '1' 11 | option event '7' 12 | 13 | config mo '3' 14 | option name 'R301_DL_DIM' 15 | option tagname 'linknx' 16 | option dpt '3.007' 17 | list state 'Heller' 18 | list state 'Dunkler' 19 | list state 'Stop' 20 | option group 'R301' 21 | option description 'R301 Deckenleuchte Dim' 22 | option addr '0/0/3' 23 | option Out_Of_Service '0' 24 | option fb_value '3' 25 | option value '3' 26 | option value_time '0' 27 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_mv.config: -------------------------------------------------------------------------------- 1 | config mv 'default' 2 | list state 'up' 3 | list state 'down' 4 | list state 'unreachable' 5 | list state 'flaping' 6 | list alarmstate 'down' 7 | list alarmstate 'unreachable' 8 | list alarmstate 'flaping' 9 | option description 'Multi State Value' 10 | option nc '1' 11 | option event '7' 12 | 13 | config mv '0' 14 | option name 'TR_EZR00_SV01' 15 | option value '1' 16 | option description '192.168.100.29' 17 | 18 | config mv '1' 19 | option name 'TR_EZR01_SV01' 20 | option value '1' 21 | option description '192.168.100.30' 22 | 23 | config mv '2' 24 | option name 'TR_EZR02_SV01' 25 | option value '1' 26 | option description '192.168.100.32' 27 | 28 | config mv '3' 29 | option name 'TR_EZR02_SV02' 30 | option value '1' 31 | option description '192.168.100.33' 32 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_nc.config: -------------------------------------------------------------------------------- 1 | 2 | config nc 'default' 3 | option description 'Notification Class default' 4 | option name 'Notification Class' 5 | option group 'ZF' 6 | 7 | config nc '0' 8 | option description 'Network Monitoring' 9 | option name 'Komunikationfehler' 10 | option group 'ZF' 11 | list recipient '65535' 12 | list recipient '1,104.13.8.92:47808' 13 | 14 | config nc '1' 15 | option description 'Modbus Sensor Fehler' 16 | option name 'Sensor Fehler' 17 | option group 'ZF' 18 | list recipient '65535' 19 | list recipient '1,104.13.8.92:47808' 20 | 21 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacnet_tl.config: -------------------------------------------------------------------------------- 1 | 2 | config tl 'default' 3 | option description 'Analog Value' 4 | option nc '1' 5 | option device_type '8' 6 | option object_type '2' 7 | option interval '99' 8 | 9 | config tl '0' 10 | option object_instance '0' 11 | option object_type '2' 12 | option interval '10' 13 | 14 | config tl '1' 15 | option object_instance '1' 16 | option object_type '2' 17 | option interval '11' 18 | 19 | config tl '2' 20 | option object_instance '2' 21 | option object_type '2' 22 | option interval '12' 23 | 24 | config tl '3' 25 | option object_instance '3' 26 | option object_type '2' 27 | option interval '13' 28 | 29 | config tl '4' 30 | option object_instance '4' 31 | option object_type '2' 32 | option interval '14' 33 | 34 | config tl '5' 35 | option object_instance '0' 36 | option object_type '0' 37 | option interval '10' 38 | 39 | config tl '6' 40 | option object_instance '1' 41 | option object_type '0' 42 | option interval '11' 43 | 44 | config tl '7' 45 | option object_instance '2' 46 | option object_type '0' 47 | option interval '12' 48 | 49 | config tl '8' 50 | option object_instance '3' 51 | option object_type '0' 52 | option interval '13' 53 | 54 | config tl '9' 55 | option object_instance '4' 56 | option object_type '0' 57 | option interval '14' 58 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacrouter.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2013 Patrick Grimm 3 | 4 | START=60 5 | USE_PROCD=1 6 | SERVER_BIN="/usr/sbin/bacserv-router" 7 | 8 | start_dev() { 9 | local cfg=$1 10 | config_get enable_rt $cfg enable_rt "0" 11 | [ "$enable_rt" == "1" ] || return 12 | config_get bacdl $cfg bacdl "bip" 13 | config_get iface $cfg iface "lan" 14 | network_get_device ifname "$iface" 15 | if [ "$bacdl" == "bip" ] ; then 16 | procd_append_param command --device "bip" 17 | procd_append_param command --interface "$ifname" 18 | config_get net $cfg net "1" 19 | procd_append_param command --network "$net" 20 | config_get port $cfg port "47808" 21 | procd_append_param command --port "$port" 22 | elif [ "$bacdl" == "mstp" ] ; then 23 | procd_append_param command --device "mstp" 24 | procd_append_param command --interface "$iface" 25 | config_get net $cfg net "2" 26 | procd_append_param command --network "$net" 27 | config_get mac $cfg mac "1" 28 | config_get max_master $cfg max_master "127" 29 | config_get max_frames $cfg max_frames "1" 30 | procd_append_param command --mac "$mac" "$max_master" "$max_frames" 31 | config_get baud $cfg baud "38400" 32 | procd_append_param command --baud "$baud" 33 | config_get parity_bit $cfg parity_bit "N" 34 | procd_append_param command --parity "$parity_bit" 35 | config_get data_bit $cfg data_bit "8" 36 | procd_append_param command --databits "$data_bit" 37 | config_get stop_bit $cfg stopbits "1" 38 | procd_append_param command --stopbits "$stop_bit" 39 | fi 40 | } 41 | 42 | start_service() { 43 | . /lib/functions/network.sh 44 | config_load bacnet_dev 45 | procd_open_instance 46 | procd_set_param command "$SERVER_BIN" 47 | config_foreach start_dev dev 48 | procd_set_param respawn 49 | procd_set_param stderr 1 50 | procd_open_trigger 51 | procd_add_raw_trigger "interface.*" 2000 /etc/init.d/bacrouter restart 52 | config_files="network bacnet_dev" 53 | for file in $config_files ; do 54 | if [ -f "/etc/config/$file" ] ; then 55 | procd_add_config_trigger "config.change" "$file" /etc/init.d/bacrouter restart 56 | fi 57 | done 58 | procd_close_trigger 59 | procd_close_instance 60 | } 61 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacserv.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2013 Patrick Grimm 3 | 4 | START=60 5 | USE_PROCD=1 6 | SERVER_BIN="/usr/sbin/bacserv" 7 | 8 | start_dev() { 9 | local cfg=$1 10 | config_get enable $cfg enable "0" 11 | [ "$enable" == "1" ] || return 12 | config_get bacdl $cfg bacdl "bip6" 13 | BIN="$SERVER_BIN-$bacdl" 14 | [ -f "$BIN" ] || return 15 | config_get iface $cfg iface "lan" 16 | network_get_device ifname "$iface" 17 | procd_open_instance 18 | procd_set_param respawn 19 | procd_set_param stderr 1 20 | procd_set_param command "$BIN" 21 | if [ "$bacdl" == "bip" ] || [ "$bacdl" == "bip6" ] ; then 22 | config_get port $cfg port "47808" 23 | procd_set_param env \ 24 | UCI_SECTION="$cfg" \ 25 | BACNET_DATALINK="$bacdl" \ 26 | BACNET_IFACE="$ifname" \ 27 | BACNET_IP_PORT="$port" 28 | else 29 | procd_set_param env \ 30 | UCI_SECTION="$cfg" \ 31 | BACNET_DATALINK="$bacdl" \ 32 | BACNET_IFACE="$ifname" 33 | fi 34 | procd_open_trigger 35 | procd_add_raw_trigger "interface.*" 2000 /etc/init.d/bacserv restart 36 | config_files="network bacnet_ai bacnet_ao bacnet_av bacnet_bi bacnet_bo \ 37 | bacnet_bv bacnet_dev bacnet_mi bacnet_mo bacnet_mv bacnet_nc \ 38 | bacnet_tl" 39 | for file in $config_files ; do 40 | if [ -f "/etc/config/$file" ] ; then 41 | procd_add_config_trigger "config.change" "$file" /etc/init.d/bacserv restart 42 | fi 43 | done 44 | procd_close_trigger 45 | procd_close_instance 46 | } 47 | 48 | start_service() { 49 | . /lib/functions/network.sh 50 | config_load bacnet_dev 51 | config_foreach start_dev dev 52 | } 53 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacserv_bip.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | 5 | setup_system() { 6 | local cfg=$1 7 | config_get hostname $cfg hostname 8 | config_get hostname_rand $cfg hostname_rand 9 | } 10 | 11 | setup_bacnet() { 12 | local cfg=$1 13 | dev_idx=$(($cfg+1)) 14 | config_get bacdl $cfg bacdl 15 | if [ "$bacdl" == "bip" ] ; then 16 | has_bip=1 17 | config_get name $cfg name 18 | if [ -z "$name" ] || [ "$name" == "openwrt-router-bip" ] ; then 19 | uci_set bacnet_dev $cfg name "$hostname-bip" 20 | uci_set bacnet_dev $cfg Id "$hostname_rand" 21 | uci_commit bacnet_dev 22 | fi 23 | fi 24 | } 25 | 26 | local hostname 27 | local hostname_rand 28 | config_load system 29 | config_foreach setup_system system 30 | 31 | if [ -z "hostname_rand" ] ; then 32 | hostname_rand="$(echo -n $(head -n 1 /dev/urandom 2>/dev/null | md5sum | cut -b 1-4))" 33 | hostname_rand="$(printf "%d" "0x$hostname_rand")" 34 | hostname="$hostname-$hostname_rand" 35 | fi 36 | 37 | local has_bip='' 38 | local dev_idx=0 39 | config_load bacnet_dev 40 | config_foreach setup_bacnet dev 41 | if [ -z "$has_bip" ] ; then 42 | cfg=$dev_idx 43 | uci_add bacnet_dev dev $cfg 44 | uci_set bacnet_dev $cfg enable "1" 45 | uci_set bacnet_dev $cfg description "Linux Embedded Development Environment on ID $hostname_rand" 46 | uci_set bacnet_dev $cfg modelname "LEDE" 47 | uci_set bacnet_dev $cfg location "Europe" 48 | uci_set bacnet_dev $cfg app_ver "12.09" 49 | uci_set bacnet_dev $cfg name "$hostname-bip" 50 | uci_set bacnet_dev $cfg Id "$hostname_rand" 51 | uci_set bacnet_dev $cfg port "47808" 52 | uci_set bacnet_dev $cfg net "0" 53 | uci_set bacnet_dev $cfg iface "lan" 54 | uci_set bacnet_dev $cfg bacdl "bip" 55 | uci_commit bacnet_dev 56 | fi 57 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacserv_bip6.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | 5 | setup_system() { 6 | local cfg=$1 7 | config_get hostname $cfg hostname 8 | config_get hostname_rand $cfg hostname_rand 9 | } 10 | 11 | setup_bacnet() { 12 | local cfg=$1 13 | dev_idx=$(($cfg+1)) 14 | config_get bacdl $cfg bacdl 15 | if [ "$bacdl" == "bip6" ] ; then 16 | has_bip=1 17 | config_get name $cfg name 18 | if [ -z "$name" ] || [ "$name" == "openwrt-router-bip6" ] ; then 19 | uci_set bacnet_dev $cfg name "$hostname-bip6" 20 | uci_set bacnet_dev $cfg Id "$hostname_rand" 21 | uci_commit bacnet_dev 22 | fi 23 | fi 24 | } 25 | 26 | local hostname 27 | local hostname_rand 28 | config_load system 29 | config_foreach setup_system system 30 | 31 | if [ -z "hostname_rand" ] ; then 32 | hostname_rand="$(echo -n $(head -n 1 /dev/urandom 2>/dev/null | md5sum | cut -b 1-4))" 33 | hostname_rand="$(printf "%d" "0x$hostname_rand")" 34 | hostname="$hostname-$hostname_rand" 35 | fi 36 | 37 | local has_bip6='' 38 | local dev_idx=0 39 | config_load bacnet_dev 40 | config_foreach setup_bacnet dev 41 | if [ -z "$has_bip" ] ; then 42 | cfg=$dev_idx 43 | uci_add bacnet_dev dev $cfg 44 | uci_set bacnet_dev $cfg enable "1" 45 | uci_set bacnet_dev $cfg description "Linux Embedded Development Environment on ID $hostname_rand" 46 | uci_set bacnet_dev $cfg modelname "LEDE" 47 | uci_set bacnet_dev $cfg location "Europe" 48 | uci_set bacnet_dev $cfg app_ver "12.09" 49 | uci_set bacnet_dev $cfg name "$hostname-bip6" 50 | uci_set bacnet_dev $cfg Id "$hostname_rand" 51 | uci_set bacnet_dev $cfg port "47808" 52 | uci_set bacnet_dev $cfg net "0" 53 | uci_set bacnet_dev $cfg iface "lan" 54 | uci_set bacnet_dev $cfg bacdl "bip6" 55 | uci_commit bacnet_dev 56 | fi 57 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacserv_ethernet.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | 5 | setup_system() { 6 | local cfg=$1 7 | config_get hostname $cfg hostname 8 | config_get hostname_rand $cfg hostname_rand 9 | } 10 | 11 | setup_bacnet() { 12 | local cfg=$1 13 | dev_idx=$(($cfg+1)) 14 | config_get bacdl $cfg bacdl 15 | if [ "$bacdl" == "ethernet" ] ; then 16 | has_ethernet=1 17 | config_get name $cfg name 18 | if [ -z "$name" ] || [ "$name" == "openwrt-router-ethernet" ] ; then 19 | uci_set bacnet_dev $cfg name "$hostname-ethernet" 20 | uci_set bacnet_dev $cfg Id "$hostname_rand" 21 | uci_commit bacnet_dev 22 | fi 23 | fi 24 | } 25 | 26 | local hostname 27 | local hostname_rand 28 | config_load system 29 | config_foreach setup_system system 30 | 31 | if [ -z "hostname_rand" ] ; then 32 | hostname_rand="$(echo -n $(head -n 1 /dev/urandom 2>/dev/null | md5sum | cut -b 1-4))" 33 | hostname_rand="$(printf "%d" "0x$hostname_rand")" 34 | hostname="$hostname-$hostname_rand" 35 | fi 36 | 37 | local has_ethernet='' 38 | local dev_idx=0 39 | config_load bacnet_dev 40 | config_foreach setup_bacnet dev 41 | if [ -z "$has_ethernet" ] ; then 42 | cfg=$dev_idx 43 | uci_add bacnet_dev dev $cfg 44 | uci_set bacnet_dev $cfg enable "1" 45 | uci_set bacnet_dev $cfg description "Linux Embedded Development Environment on ID $hostname_rand" 46 | uci_set bacnet_dev $cfg modelname "LEDE" 47 | uci_set bacnet_dev $cfg location "Europe" 48 | uci_set bacnet_dev $cfg app_ver "12.09" 49 | uci_set bacnet_dev $cfg name "$hostname-ethernet" 50 | uci_set bacnet_dev $cfg Id "$hostname_rand" 51 | uci_set bacnet_dev $cfg net "0" 52 | uci_set bacnet_dev $cfg iface "lan" 53 | uci_set bacnet_dev $cfg bacdl "ethernet" 54 | uci_commit bacnet_dev 55 | fi 56 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacserv_mstp.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | 5 | setup_system() { 6 | local cfg=$1 7 | config_get hostname $cfg hostname 8 | config_get hostname_rand $cfg hostname_rand 9 | } 10 | 11 | setup_bacnet() { 12 | local cfg=$1 13 | dev_idx=$(($cfg+1)) 14 | config_get bacdl $cfg bacdl 15 | if [ "$bacdl" == "mstp" ] ; then 16 | has_mstp=1 17 | config_get name $cfg name 18 | if [ -z "$name" ] || [ "$name" == "openwrt-router-mstp" ] ; then 19 | uci_set bacnet_dev $cfg name "$hostname-mstp" 20 | uci_set bacnet_dev $cfg Id "$hostname_rand" 21 | uci_commit bacnet_dev 22 | fi 23 | fi 24 | } 25 | 26 | local hostname 27 | local hostname_rand 28 | config_load system 29 | config_foreach setup_system system 30 | 31 | if [ -z "hostname_rand" ] ; then 32 | hostname_rand="$(echo -n $(head -n 1 /dev/urandom 2>/dev/null | md5sum | cut -b 1-4))" 33 | hostname_rand="$(printf "%d" "0x$hostname_rand")" 34 | hostname="$hostname-$hostname_rand" 35 | fi 36 | 37 | local has_mstp='' 38 | local dev_idx=0 39 | config_load bacnet_dev 40 | config_foreach setup_bacnet dev 41 | if [ -z "$has_mstp" ] ; then 42 | cfg=$dev_idx 43 | uci_add bacnet_dev dev $cfg 44 | uci_set bacnet_dev $cfg enable "1" 45 | uci_set bacnet_dev $cfg description "Linux Embedded Development Environment on ID $hostname_rand" 46 | uci_set bacnet_dev $cfg modelname "LEDE" 47 | uci_set bacnet_dev $cfg location "Europe" 48 | uci_set bacnet_dev $cfg app_ver "12.09" 49 | uci_set bacnet_dev $cfg name "$hostname-mstp" 50 | uci_set bacnet_dev $cfg Id "$hostname_rand" 51 | uci_set bacnet_dev $cfg port "47808" 52 | uci_set bacnet_dev $cfg net "0" 53 | uci_set bacnet_dev $cfg iface "/dev/ttyUSB0" 54 | uci_set bacnet_dev $cfg bacdl "mstp" 55 | uci_commit bacnet_dev 56 | fi 57 | -------------------------------------------------------------------------------- /bacnet-stack/files/bacserv_router.defaults: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | 5 | setup_system() { 6 | local cfg=$1 7 | config_get hostname $cfg hostname 8 | config_get hostname_rand $cfg hostname_rand 9 | } 10 | 11 | setup_bacnet() { 12 | local cfg=$1 13 | [ $cfg -gt $dev_idx ] && dev_idx=$cfg 14 | config_get bacdl $cfg bacdl 15 | if [ "$bacdl" == "bip" ] ; then 16 | has_bip=1 17 | config_get name $cfg name 18 | if [ -z "$name" ] || [ "$name" == "openwrt-router-bip" ] ; then 19 | uci_set bacnet_dev $cfg name "$hostname-bip" 20 | uci_set bacnet_dev $cfg Id "$hostname_rand" 21 | uci_set bacnet_dev $cfg enable_rt "1" 22 | uci_commit bacnet_dev 23 | fi 24 | fi 25 | if [ "$bacdl" == "mstp" ] ; then 26 | has_mstp=1 27 | config_get name $cfg name 28 | if [ -z "$name" ] || [ "$name" == "openwrt-router-mstp" ] ; then 29 | uci_set bacnet_dev $cfg name "$hostname-mstp" 30 | uci_set bacnet_dev $cfg Id "$hostname_rand" 31 | uci_set bacnet_dev $cfg enable_rt "1" 32 | uci_commit bacnet_dev 33 | fi 34 | fi 35 | } 36 | 37 | hostname='' 38 | hostname_rand='' 39 | config_load system 40 | config_foreach setup_system system 41 | 42 | if [ -z "hostname_rand" ] ; then 43 | hostname_rand="$(echo -n $(head -n 1 /dev/urandom 2>/dev/null | md5sum | cut -b 1-4))" 44 | hostname_rand="$(printf "%d" "0x$hostname_rand")" 45 | hostname="$hostname-$hostname_rand" 46 | fi 47 | 48 | has_bip='' 49 | has_mstp='' 50 | dev_idx="-1" 51 | [ -f /etc/config/bacnet_dev ] || touch /etc/config/bacnet_dev 52 | config_load bacnet_dev 53 | config_foreach setup_bacnet dev 54 | if [ -z "$has_bip" ] ; then 55 | dev_idx=$((dev_idx+1)) 56 | cfg=$dev_idx 57 | uci_add bacnet_dev dev $cfg 58 | uci_set bacnet_dev $cfg enable "1" 59 | uci_set bacnet_dev $cfg enable_rt "1" 60 | uci_set bacnet_dev $cfg description "Linux Embedded Development Environment on ID $hostname_rand" 61 | uci_set bacnet_dev $cfg modelname "LEDE" 62 | uci_set bacnet_dev $cfg location "Europe" 63 | uci_set bacnet_dev $cfg app_ver "12.09" 64 | uci_set bacnet_dev $cfg name "$hostname-bip" 65 | uci_set bacnet_dev $cfg Id "$hostname_rand" 66 | uci_set bacnet_dev $cfg port "47808" 67 | uci_set bacnet_dev $cfg net "1" 68 | uci_set bacnet_dev $cfg iface "lan" 69 | uci_set bacnet_dev $cfg bacdl "bip" 70 | uci_commit bacnet_dev 71 | fi 72 | if [ -z "$has_mstp" ] ; then 73 | dev_idx=$((dev_idx+1)) 74 | cfg=$dev_idx 75 | uci_add bacnet_dev dev $cfg 76 | uci_set bacnet_dev $cfg enable "1" 77 | uci_set bacnet_dev $cfg enable_rt "1" 78 | uci_set bacnet_dev $cfg description "Linux Embedded Development Environment on ID $hostname_rand" 79 | uci_set bacnet_dev $cfg modelname "LEDE" 80 | uci_set bacnet_dev $cfg location "Europe" 81 | uci_set bacnet_dev $cfg app_ver "12.09" 82 | uci_set bacnet_dev $cfg name "$hostname-mstp" 83 | uci_set bacnet_dev $cfg Id "$hostname_rand" 84 | uci_set bacnet_dev $cfg port "47808" 85 | uci_set bacnet_dev $cfg net "6661" 86 | uci_set bacnet_dev $cfg iface "/dev/ttyUSB0" 87 | uci_set bacnet_dev $cfg bacdl "mstp" 88 | uci_commit bacnet_dev 89 | fi 90 | -------------------------------------------------------------------------------- /dmx4linux/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2006-2009 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | # $Id: Makefile 14307 2009-07-09 13:26:57Z pg $ 8 | 9 | include $(TOPDIR)/rules.mk 10 | include $(INCLUDE_DIR)/kernel.mk 11 | 12 | #http://www.cubic.org/~michael/dmx4linux-daily/dmx4linux-2008-11-15.tar.bz2 13 | PKG_NAME:=dmx4linux 14 | PKG_VERSION:=2008-11-15 15 | PKG_RELEASE:=1 16 | PKG_SOURCE:=dmx4linux-$(PKG_VERSION).tar.bz2 17 | PKG_SOURCE_URL:=http://www.cubic.org/~michael/dmx4linux-daily/ 18 | #PKG_MD5SUM:=3ee301b5d0e8df9e4b915af58b725556 19 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/dmx4linux-$(PKG_VERSION) 20 | PATCH_DIR=./patches 21 | 22 | include $(INCLUDE_DIR)/package.mk 23 | 24 | DMX4LINUX_FILES:= \ 25 | $(PKG_BUILD_DIR)/drivers/dmxdev/dmxdev.$(LINUX_KMOD_SUFFIX) 26 | 27 | # $(PKG_BUILD_DIR)/drivers/devices/usb/usb2dmx.$(LINUX_KMOD_SUFFIX) \ 28 | # $(PKG_BUILD_DIR)/drivers/devices/usb/ftdi2dmx.$(LINUX_KMOD_SUFFIX) \ 29 | # $(PKG_BUILD_DIR)/drivers/devices/usb/sunlite.$(LINUX_KMOD_SUFFIX) 30 | 31 | 32 | DMX4LINUX_AUTOLOAD:= \ 33 | dmxdev \ 34 | sunlite \ 35 | ftdi2dmx \ 36 | usb2dmx 37 | 38 | define KernelPackage/dmx4linux 39 | SUBMENU:=Other modules 40 | TITLE:=Driver usb dmx 41 | FILES:=$(DMX4LINUX_FILES) 42 | AUTOLOAD:=$(call AutoLoad,60,dmx4linux) 43 | DEPENDS:=+kmod-usb2 44 | endef 45 | 46 | 47 | MAKE_ARGS:= \ 48 | PATH="$(TARGET_PATH)" \ 49 | ARCH="$(LINUX_KARCH)" \ 50 | CROSS_COMPILE="$(TARGET_CROSS)" \ 51 | TOOLPREFIX="$(KERNEL_CROSS)" \ 52 | TOOLPATH="$(KERNEL_CROSS)" \ 53 | KERNELPATH="$(LINUX_DIR)" \ 54 | KDIR="$(LINUX_DIR)" \ 55 | LDOPTS="--no-warn-mismatch " \ 56 | CFLAGS="-I$(KERNEL_BUILD_DIR)/include $(TARGET_CFLAGS)" \ 57 | KBUILD_VERBOSE=1 58 | 59 | #LIBDIR="$(KERNEL_BUILD_DIR)/fritz/var/lib/fritz" 60 | 61 | define Build/Prepare 62 | $(call Build/Prepare/Default) 63 | endef 64 | 65 | 66 | #define Build/Compile 67 | # $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/drivers/devices/usb $(MAKE_ARGS) 68 | #endef 69 | 70 | define Build/Compile 71 | $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/drivers/dmxdev $(MAKE_ARGS) 72 | endef 73 | 74 | 75 | $(eval $(call KernelPackage,dmx4linux)) 76 | -------------------------------------------------------------------------------- /libmbus/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2011-2018 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=libmbus 11 | PKG_VERSION:=2018-03-28-1 12 | PKG_SOURCE_VERSION:=027f6fb6899b902bdd7d0b3230ecccc24f6bc6c3 13 | PKG_RELEASE:=$(PKG_SOURCE_VERSION) 14 | 15 | PKG_SOURCE_PROTO:=git 16 | PKG_SOURCE_URL:=git://github.com/rscada/libmbus.git 17 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 18 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz 19 | 20 | PKG_FIXUP:=autoreconf 21 | PKG_INSTALL:=1 22 | 23 | include $(INCLUDE_DIR)/package.mk 24 | 25 | define Package/libmbus/Default 26 | SECTION:=utils 27 | CATEGORY:=Utilities 28 | URL:=http://www.rscada.se/libmbus 29 | TITLE:=mbus-tools 30 | endef 31 | 32 | define Package/libmbus/Default/description 33 | libmbus is an open source M-bus (Meter-Bus) library. 34 | The Meter-Bus is a standard for reading out meter data from 35 | electricity meters, heat meters, gas meters, etc. 36 | endef 37 | 38 | define Package/libmbus 39 | $(call Package/libmbus/Default) 40 | SECTION:=libs 41 | CATEGORY:=Libraries 42 | TITLE:=libmbus 43 | endef 44 | 45 | define Package/libmbus/description 46 | $(call Package/libmbus/Default/description) 47 | 48 | This package contains the M-bus shared library, used by other programs. 49 | endef 50 | 51 | define Package/mbus-serial 52 | $(call Package/libmbus/Default) 53 | DEPENDS+=+libmbus 54 | TITLE+= (serial) 55 | endef 56 | 57 | define Package/mbus-serial/description 58 | $(call Package/libmbus/Default/description) 59 | 60 | This package contains command line tools for scanning the M-bus 61 | and retrieving data from meters which are connected through a 62 | serial (e.g. RS232) interface. 63 | endef 64 | 65 | define Package/mbus-tcp 66 | $(call Package/libmbus/Default) 67 | DEPENDS+=+libmbus 68 | TITLE+= (tcp) 69 | endef 70 | 71 | define Package/mbus-tcp/description 72 | $(call Package/libmbus/Default/description) 73 | 74 | This package contains command line tools for scanning the M-bus 75 | and retrieving data from meters which are accessible through 76 | M-bus gateways via TCP. 77 | endef 78 | 79 | TARGET_CFLAGS += $(FPIC) 80 | 81 | define Build/InstallDev 82 | $(INSTALL_DIR) $(1)/usr/include 83 | $(CP) $(PKG_INSTALL_DIR)/usr/include/mbus $(1)/usr/include/ 84 | $(INSTALL_DIR) $(1)/usr/lib 85 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmbus.{so*,la} $(1)/usr/lib/ 86 | $(INSTALL_DIR) $(1)/usr/lib/pkgconfig 87 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libmbus.pc $(1)/usr/lib/pkgconfig/ 88 | endef 89 | 90 | define Package/libmbus/install 91 | $(INSTALL_DIR) $(1)/usr/lib 92 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmbus.so* $(1)/usr/lib/ 93 | endef 94 | 95 | define Package/mbus-serial/install 96 | $(INSTALL_DIR) $(1)/usr/bin 97 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbus-serial-* $(1)/usr/bin/ 98 | endef 99 | 100 | define Package/mbus-tcp/install 101 | $(INSTALL_DIR) $(1)/usr/bin 102 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mbus-tcp-* $(1)/usr/bin/ 103 | endef 104 | 105 | $(eval $(call BuildPackage,libmbus)) 106 | $(eval $(call BuildPackage,mbus-serial)) 107 | $(eval $(call BuildPackage,mbus-tcp)) 108 | -------------------------------------------------------------------------------- /libpiface/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=libpiface 4 | PKG_VERSION:=1.0 5 | PKG_RELEASE:=0 6 | 7 | PKG_SOURCE_URL:=http://lunatiki.de/ 8 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 9 | #PKG_FIXUP:=autoreconf 10 | #PKG_REMOVE_FILES:=autogen.sh 11 | PKG_INSTALL:=1 12 | #CONFIGURE_CMD = ./autogen.sh 13 | 14 | include $(INCLUDE_DIR)/package.mk 15 | 16 | define Package/libpiface 17 | SECTION:=net 18 | CATEGORY:=Network 19 | TITLE:=libpiface 20 | URL:=https://github.com/thomasmacpherson/piface 21 | DEPENDS:=@TARGET_brcm2708 +kmod-spi-bcm2708 22 | endef 23 | 24 | define Package/libpiface/description 25 | libpiface 26 | endef 27 | 28 | define Build/InstallDev 29 | $(INSTALL_DIR) $(1)/usr/include 30 | $(CP) $(PKG_BUILD_DIR)/src/piface/pfio.h $(1)/usr/include/ 31 | $(INSTALL_DIR) $(1)/usr/lib 32 | $(CP) $(PKG_BUILD_DIR)/.libs/libpiface-* $(1)/usr/lib/ 33 | endef 34 | 35 | define Package/libpiface/install 36 | $(INSTALL_DIR) $(1)/usr/lib 37 | $(CP) $(PKG_BUILD_DIR)/.libs/libpiface-1.0.so.* $(1)/usr/lib 38 | endef 39 | 40 | # $(CP) $(PKG_INSTALL_DIR)/libpiface-1.0.so.* $(1)/usr/lib 41 | 42 | $(eval $(call BuildPackage,libpiface)) 43 | -------------------------------------------------------------------------------- /libwebsockets/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014-2015 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=libwebsockets 11 | PKG_SOURCE_VERSION:=082e33b91f7ce1e0dad77d012ef2996ed3ba162a 12 | PKG_VERSION:=2016-02-14-$(PKG_SOURCE_VERSION) 13 | PKG_RELEASE:=1 14 | 15 | PKG_SOURCE_PROTO:=git 16 | PKG_SOURCE_URL:=https://github.com/warmcat/libwebsockets.git 17 | PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) 18 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz 19 | 20 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) 21 | 22 | PKG_LICENSE:=LGPL-2.1+exception 23 | PKG_LICENSE_FILES:=LICENSE 24 | 25 | CMAKE_INSTALL:=1 26 | 27 | include $(INCLUDE_DIR)/package.mk 28 | include $(INCLUDE_DIR)/cmake.mk 29 | 30 | define Package/libwebsockets 31 | SECTION:=libs 32 | CATEGORY:=Libraries 33 | TITLE:=libwebsockets 34 | DEPENDS:=+zlib +libcyassl 35 | endef 36 | 37 | CMAKE_OPTIONS += -DLWS_WITHOUT_TESTAPPS=ON 38 | CMAKE_OPTIONS += -DLWS_OPENSSL_CLIENT_CERTS=/etc/ssl/certs 39 | CMAKE_OPTIONS += -DLWS_OPENSSL_SUPPORT=ON 40 | CMAKE_OPTIONS += -DLWS_WITH_SSL=ON 41 | CMAKE_OPTIONS += -DLWS_USE_CYASSL=ON 42 | CMAKE_OPTIONS += -DLWS_USE_WOLFSSL=OFF 43 | CMAKE_OPTIONS += -DLWS_CYASSL_LIBRARIES=$(STAGING_DIR)/usr/lib/libcyassl.so 44 | CMAKE_OPTIONS += -DLWS_CYASSL_INCLUDE_DIRS=$(STAGING_DIR)/usr/include 45 | 46 | define Package/libwebsockets/install 47 | $(INSTALL_DIR) $(1)/usr/lib 48 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libwebsockets.so.6 $(1)/usr/lib/ 49 | $(LN) $(1)/usr/lib/libwebsockets.so.6 $(1)/usr/lib/libwebsockets.so 50 | endef 51 | 52 | $(eval $(call BuildPackage,libwebsockets)) 53 | -------------------------------------------------------------------------------- /linknx-uci/Makefile: -------------------------------------------------------------------------------- 1 | # $Id: Makefile 1146 2005-06-05 13:32:28Z nbd $ 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=linknx-uci 6 | PKG_VERSION:=0.3.5 7 | PKG_RELEASE:=0 8 | 9 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 10 | 11 | include $(INCLUDE_DIR)/package.mk 12 | 13 | define Package/linknx-uci 14 | SECTION:=net 15 | CATEGORY:=Network 16 | TITLE:=Config generator for LINKNX and mqtt-client 17 | URL:=https://sourceforge.net/p/linknx/wiki/Main_Page/ 18 | EXTRA_DEPENDS:=linknx, libuci-lua, luaexpat, luci-lib-nixio, lua-mosquitto, mosquitto 19 | endef 20 | 21 | define Build/Compile 22 | endef 23 | 24 | define Package/linknx-uci/install 25 | $(INSTALL_DIR) $(1)/etc/config 26 | $(INSTALL_CONF) ./files/etc/config/linknx_mqtt $(1)/etc/config 27 | $(INSTALL_DIR) $(1)/etc/init.d 28 | $(INSTALL_BIN) ./files/etc/init.d/linknx-uci $(1)/etc/init.d 29 | $(INSTALL_DIR) $(1)/usr/bin 30 | $(INSTALL_BIN) ./files/usr/bin/linknxloaddata.lua $(1)/usr/bin 31 | $(INSTALL_BIN) ./files/usr/bin/linknxmapper.lua $(1)/usr/bin 32 | $(INSTALL_BIN) ./files/usr/bin/linknxhb.lua $(1)/usr/bin 33 | $(INSTALL_BIN) ./files/usr/bin/linknxreadvalue.lua $(1)/usr/bin 34 | $(INSTALL_BIN) ./files/usr/bin/linknxwritevalue.lua $(1)/usr/bin 35 | $(INSTALL_BIN) ./files/usr/bin/ets5xml2uci.lua $(1)/usr/bin 36 | $(INSTALL_DIR) $(1)/usr/sbin 37 | $(INSTALL_BIN) ./files/usr/sbin/linknxsubsscribemqtt.lua $(1)/usr/sbin 38 | endef 39 | 40 | $(eval $(call BuildPackage,linknx-uci)) 41 | -------------------------------------------------------------------------------- /linknx-uci/files/etc/config/linknx_mqtt: -------------------------------------------------------------------------------- 1 | 2 | config conn mqtt 3 | option host 'localhost' 4 | option port '1883' 5 | option user 'admin' 6 | option pw 'admin' 7 | -------------------------------------------------------------------------------- /linknx-uci/files/etc/init.d/linknx-uci: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2012 Patrick Grimm 3 | 4 | START=99 5 | USE_PROCD=1 6 | SERVER_BIN=/usr/sbin/linknxsubsscribemqtt.lua 7 | 8 | load_uci() { 9 | /usr/bin/linknxloaddata.lua 10 | } 11 | 12 | start_service() { 13 | load_uci 14 | procd_open_instance 15 | procd_set_param command "$SERVER_BIN" 16 | procd_set_param respawn 17 | procd_set_param stderr 1 18 | procd_open_trigger 19 | procd_add_raw_trigger "interface.*" 2000 /etc/init.d/linknx-uci restart 20 | config_files="$(ls /etc/config/knx*)" 21 | for file in $config_files ; do 22 | if [ -f "$file" ] ; then 23 | chmod 644 $file 24 | procd_add_config_trigger "config.change" "$file" /etc/init.d/linknx-uci restart 25 | fi 26 | done 27 | procd_close_trigger 28 | procd_close_instance 29 | } 30 | 31 | reload_service() { 32 | load_uci 33 | } 34 | 35 | restart_service() { 36 | stop 37 | /etc/init.d/linknx restart 38 | start 39 | } 40 | -------------------------------------------------------------------------------- /linknx-uci/files/usr/bin/ets5xml2uci.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | require "uci" 4 | lxp = require("lxp") 5 | 6 | local count = 0 7 | local main_group_name = "" 8 | local main_group_nr = 0 9 | local main_group_start = 0 10 | local middle_group_name = "" 11 | local middle_group_nr = 0 12 | local sub_group_name = "" 13 | local sub_group_nr = 0 14 | callbacks = { 15 | StartElement = function (parser, name, attributes) 16 | count = count + 1 17 | if count == 2 then 18 | if attributes["RangeStart"] then 19 | main_group_start = tonumber(attributes["RangeStart"]) 20 | main_group_nr = math.floor(main_group_start/2048) 21 | end 22 | if attributes["Name"] then 23 | main_group_name = attributes["Name"] 24 | end 25 | elseif count == 3 then 26 | if attributes["RangeStart"] then 27 | middle_group_start = tonumber(attributes["RangeStart"]) 28 | middle_group_nr = math.floor((middle_group_start-main_group_start+1)/256) 29 | local f = io.open("/etc/config/knx_"..main_group_nr.."_"..middle_group_nr,"r") 30 | if f~=nil then 31 | io.close(f) 32 | else 33 | f = io.open("/etc/config/knx_"..main_group_nr.."_"..middle_group_nr, "w") 34 | f:write() 35 | f:close() 36 | end 37 | end 38 | if attributes["Name"] then 39 | middle_group_name = attributes["Name"] 40 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, "main_group", "grpname") 41 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, "main_group", "Name", main_group_name) 42 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, "middle_group", "grpname") 43 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, "middle_group", "Name", middle_group_name) 44 | end 45 | elseif count == 4 then 46 | if attributes["Address"] then 47 | string.gsub(attributes["Address"],".*/.*/(.-)$",function(a) sub_group_nr = a end) 48 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, sub_group_nr, "grp") 49 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, sub_group_nr, "Address", attributes["Address"]) 50 | end 51 | if attributes["Name"] then 52 | sub_group_name = attributes["Name"] 53 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, sub_group_nr, "Name", attributes["Name"]) 54 | end 55 | if attributes["DPTs"] then 56 | local type 57 | type1=string.gsub(attributes["DPTs"],"^DPST%-(.-)%-.*$","%1") 58 | type1=tonumber(type1) 59 | type2=string.gsub(attributes["DPTs"],"^DPST%-.*%-(.-)$","%1") 60 | type2=tonumber(type2) 61 | if type1==1 then 62 | type="1.001" 63 | elseif type1==3 then 64 | type="3.006" 65 | if type2==7 then 66 | type="3.007" 67 | end 68 | elseif type1==5 then 69 | type="5.xxx" 70 | if type2==1 then 71 | type="5.001" 72 | elseif type2==3 then 73 | type="5.003" 74 | end 75 | elseif type1==6 then 76 | type="6.xxx" 77 | elseif type1==7 then 78 | type="7.xxx" 79 | elseif type1==8 then 80 | type="8.xxx" 81 | elseif type1==9 then 82 | type="9.xxx" 83 | elseif type1==10 then 84 | type="10.001" 85 | elseif type1==11 then 86 | type="11.001" 87 | elseif type1==12 then 88 | type="12.xxx" 89 | elseif type1==13 then 90 | type="13.xxx" 91 | elseif type1==14 then 92 | type="14.xxx" 93 | elseif type1==16 then 94 | type="16.000" 95 | if type2==1 then 96 | type="16.001" 97 | end 98 | elseif type1==20 then 99 | type="20.102" 100 | elseif type1==28 then 101 | type="28.001" 102 | elseif type1==29 then 103 | type="29.xxx" 104 | end 105 | if type then 106 | x:set("knx_"..main_group_nr.."_"..middle_group_nr, sub_group_nr, "type", type) 107 | end 108 | end 109 | x:commit("knx_"..main_group_nr.."_"..middle_group_nr) 110 | nixio.fs.chmod("/etc/config/knx_"..main_group_nr.."_"..middle_group_nr,644) 111 | end 112 | end, 113 | EndElement = function (parser, name, attributes) 114 | count = count - 1 115 | end, 116 | } 117 | 118 | 119 | local xmlfilename = arg[1] 120 | if not xmlfilename then 121 | print("no file name") 122 | return 123 | end 124 | 125 | local f = io.open(xmlfilename,"r") 126 | if f~=nil then 127 | io.close(f) 128 | else 129 | print("can't open file "..xmlfilename) 130 | end 131 | 132 | p = lxp.new(callbacks) 133 | x = uci.cursor() 134 | 135 | for l in io.lines(xmlfilename) do 136 | p:parse(l) 137 | p:parse("\n") 138 | end 139 | p:parse() 140 | p:close() 141 | -------------------------------------------------------------------------------- /linknx-uci/files/usr/bin/linknxhb.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | require "uci" 4 | mqtt = require "mosquitto" 5 | json = require "luci.jsonc" 6 | 7 | function sub_logger_err(msg) 8 | local pc=io.popen("logger -p error -t mqtt-sub "..msg) 9 | if pc then pc:close() end 10 | end 11 | 12 | function sub_logger_info(msg) 13 | local pc=io.popen("logger -p info -t mqtt-sub "..msg) 14 | if pc then pc:close() end 15 | end 16 | 17 | mclient = mqtt.new() 18 | x = uci.cursor() 19 | state = uci.cursor(nil, "/var/state") 20 | dp={} 21 | grp={} 22 | 23 | mclient.ON_CONNECT = function() 24 | for i=0,31 do 25 | for j=0,7 do 26 | local groupname="knx_"..i.."_"..j 27 | local f = io.open("/etc/config/"..groupname,"r") 28 | if f~=nil then 29 | io.close(f) 30 | maingrp = x:get(groupname,"main_group", "Name") 31 | middlegrp = x:get(groupname,"middle_group", "Name") 32 | x:foreach(groupname, "grp", function(s) 33 | local name = groupname.."."..s['.name'] 34 | local comment = s.Name 35 | local type = s.type 36 | if not type then 37 | sub_logger_err("no DPTs "..name.." "..comment) 38 | return 39 | end 40 | topic=maingrp.."/"..middlegrp.."/"..comment 41 | local valuejs 42 | if not valuejs and type == "1.001" then 43 | valuejs=json.stringify({ name = name, service_name = topic, service = "Lightbulb"}) 44 | end 45 | if not valuejs and type == "5.001" then 46 | valuejs=json.stringify({ name = name, service_name = topic, service = "Lightbulb"}) 47 | end 48 | if not valuejs and type == "9.xxx" then 49 | valuejs=json.stringify({ name = name, service_name = topic, service = "TemperatureSensor"}) 50 | end 51 | mclient:publish("homebridge/to/add",valuejs) 52 | end) 53 | end 54 | end 55 | end 56 | end 57 | 58 | mclient.ON_PUBLISH = function() 59 | mclient:disconnect() 60 | end 61 | 62 | mhost=x:get("linknx_mqtt", "mqtt", "host") 63 | mport=x:get("linknx_mqtt", "mqtt", "port") 64 | muser=x:get("linknx_mqtt", "mqtt", "user") 65 | mpw=x:get("linknx_mqtt", "mqtt", "pw") 66 | mclient:login_set(muser, mpw) 67 | mclient:connect(mhost, mport) 68 | mclient:loop_forever() 69 | -------------------------------------------------------------------------------- /linknx-uci/files/usr/bin/linknxloaddata.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | require "uci" 4 | nixio = require "nixio" 5 | 6 | function logger_err(msg) 7 | local pc=io.popen("logger -p error -t linknxloaddata "..msg) 8 | if pc then pc:close() end 9 | end 10 | 11 | function logger_info(msg) 12 | local pc=io.popen("logger -p info -t linknxloaddata "..msg) 13 | if pc then pc:close() end 14 | end 15 | 16 | 17 | function write(varname,addr,type) 18 | local line 19 | local init 20 | init = 'persist' 21 | line = '' 22 | line = line..'"'..varname..'"' 23 | -- line = line..'"'..varname..'"' 24 | line = line..'' 25 | s:send(line.."\r\n") 26 | s:send("\r\n\4") 27 | res = s:recv(8192) 28 | if not res then 29 | logger_err("write obj no response "..varname) 30 | elseif not string.find(res, "success") then 31 | logger_err("write obj "..varname.." not success") 32 | else 33 | logger_info("write obj "..varname..":"..addr..":"..type..":"..init) 34 | end 35 | end 36 | 37 | function writerule(id,varname,varval) 38 | local line 39 | local init 40 | init = "eval" --false|true|eval 41 | line="\n\n\n\n" 42 | line=line.."" 43 | line=line.."" 44 | line=line.."varname='"..varname.."';" 45 | line=line.."value=obj(varname);" 46 | line=line.."os.execute('/usr/bin/linknxmapper.lua '..varname..' '..value);\n" 47 | line=line.."return 1;\n" 48 | line=line.."" 49 | line=line.."" 50 | line=line.."" 51 | line=line.."" 52 | line=line.."\n" 53 | line=line.."\n" 54 | line=line.."return;\n" 55 | line=line.."\n" 56 | line=line.."\n" 57 | line=line.."\n\n\r\n\4" 58 | s:send(line) 59 | res = s:recv(8192) 60 | if not res then 61 | logger_err("write rule obj no response "..varname) 62 | elseif not string.find(res, "success") then 63 | logger_err("write rule obj "..varname.." not success") 64 | else 65 | logger_info("write rule obj "..varname..' '..id..' '..varval) 66 | end 67 | end 68 | 69 | function load_group(group) 70 | x:foreach(group, "grp", function(s) 71 | local name = group.."."..s['.name'] 72 | local comment = s.Name 73 | local addr = s.Address 74 | local type = s.type 75 | if not type then 76 | logger_err("no DPTs "..name.." "..comment) 77 | return 78 | end 79 | local value 80 | if type == "1.001" then 81 | value="on" 82 | elseif type == "5.001" then 83 | value="0" 84 | elseif type == "5.xxx" then 85 | value="0" 86 | elseif type == "9.xxx" then 87 | value="0" 88 | elseif type == "20.102" then 89 | value="comfort" 90 | end 91 | write(name,addr,type) 92 | if value then 93 | writerule(name.."_rule",name,value,type) 94 | end 95 | end) 96 | end 97 | 98 | logger_info("start") 99 | 100 | s = nixio.socket('inet', 'stream', none) 101 | s:connect('localhost','1028') 102 | --s = nixio.socket('unix', 'stream', none) 103 | --s:connect('/var/run/linknx') 104 | 105 | x = uci.cursor() 106 | for i=0,31 do 107 | for j=0,7 do 108 | local groupname="knx_"..i.."_"..j 109 | local f = io.open("/etc/config/"..groupname,"r") 110 | if f~=nil then 111 | io.close(f) 112 | load_group(groupname) 113 | end 114 | end 115 | end 116 | 117 | s:close() 118 | 119 | logger_info("end") 120 | -------------------------------------------------------------------------------- /linknx-uci/files/usr/bin/linknxmapper.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | require "uci" 4 | nixio = require "nixio" 5 | mqtt = require "mosquitto" 6 | json = require "luci.jsonc" 7 | 8 | function logger_err(msg) 9 | local pc=io.popen("logger -p error -t linknxmapper "..msg) 10 | if pc then pc:close() end 11 | end 12 | 13 | function logger_info(msg) 14 | local pc=io.popen("logger -p info -t linknxmapper "..msg) 15 | if pc then pc:close() end 16 | end 17 | 18 | local name= arg[1] 19 | local value = arg[2] 20 | local homebridge 21 | 22 | if not name then 23 | logger_err("no varname") 24 | return 25 | end 26 | 27 | if not value then 28 | logger_err(name.." no value") 29 | return 30 | end 31 | 32 | config=string.gsub(name,"^(.-)%..*$","%1") 33 | section=string.gsub(name,"^.*%.(.-)$","%1") 34 | 35 | x = uci.cursor() 36 | mhost=x:get("linknx_mqtt", "mqtt", "host") 37 | mport=x:get("linknx_mqtt", "mqtt", "port") 38 | muser=x:get("linknx_mqtt", "mqtt", "user") 39 | mpw=x:get("linknx_mqtt", "mqtt", "pw") 40 | comment=x:get(config, section, "Name") 41 | maingrp=x:get(config, "main_group", "Name") 42 | middlegrp=x:get(config, "middle_group", "Name") 43 | topic=maingrp.."/"..middlegrp.."/"..comment 44 | homebridge=x:get(config, section, "homebridge") 45 | 46 | state = uci.cursor(nil, "/var/state") 47 | count = state:get(config, section, "count") or "0" 48 | oldvalue = state:get(config, section, "oldvalue") 49 | cfgvalue = state:get(config, section, "value") 50 | count = tonumber(count) 51 | count = count + 1 52 | state:set(config, section, "count", count) 53 | state:set(config, section, "value", value) 54 | state:save(config) 55 | logger_info(name.."/"..value.."/"..topic) 56 | 57 | mclient = mqtt.new() 58 | 59 | mclient.ON_CONNECT = function() 60 | local mid 61 | mid = mclient:publish(topic,value) 62 | end 63 | mclient.ON_PUBLISH = function() 64 | mclient:disconnect() 65 | end 66 | mclient:login_set(muser, mpw) 67 | mclient:connect(mhost, mport, 5) 68 | mclient:loop_forever() 69 | 70 | if homebridge == "1" then 71 | type=x:get(config, section, "type") 72 | local valuejs 73 | if not valuejs and value == "on" then 74 | valuejs=json.stringify({ name = name, service_name = topic, characteristic = "On", value = true}) 75 | end 76 | if not valuejs and value == "off" then 77 | valuejs=json.stringify({ name = name, service_name = topic, characteristic = "On", value = false}) 78 | end 79 | if not valuejs and value == "0" then 80 | valuejs=json.stringify({ name = name, service_name = topic, characteristic = "On", value = false}) 81 | end 82 | if not valuejs and type == "9.xxx" then 83 | valuejs=json.stringify({ name = name, service_name = topic, characteristic = "CurrentTemperature", value = value}) 84 | end 85 | if not valuejs then 86 | value=math.floor(value + .5) 87 | valuejs=json.stringify({ name = name, service_name = topic, characteristic = "Brightness", value = value}) 88 | end 89 | if valuejs then 90 | mclienthb = mqtt.new() 91 | mclienthb.ON_CONNECT = function() 92 | mid = mclienthb:publish("homebridge/to/set",valuejs) 93 | end 94 | mclienthb.ON_PUBLISH = function() 95 | mclienthb:disconnect() 96 | end 97 | mclienthb:login_set(muser, mpw) 98 | mclient:connect(mhost, mport, 5) 99 | mclienthb:loop_forever() 100 | end 101 | end 102 | 103 | nixio.fs.chmod("/var/state/"..config,644) 104 | -------------------------------------------------------------------------------- /linknx-uci/files/usr/bin/linknxreadvalue.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | require "uci" 4 | nixio = require "nixio" 5 | 6 | function readval(txt) 7 | s:send("\r\n\4") 8 | ret = s:recv(8192) or '' 9 | if string.find(ret, "success") then 10 | ret = string.gsub(ret,'.*success..','') 11 | ret = string.gsub(ret,'..read.*','') 12 | print(ret) 13 | end 14 | end 15 | 16 | varname = arg[1] 17 | s = nixio.socket('inet', 'stream', none) 18 | s:connect('localhost','1028') 19 | --s = nixio.socket('unix', 'stream', none) 20 | --s:connect('/var/run/linknx') 21 | readval(varname) 22 | s:close() 23 | -------------------------------------------------------------------------------- /linknx-uci/files/usr/bin/linknxwritevalue.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | require "uci" 4 | nixio = require "nixio" 5 | 6 | function linknxwrite_logger_err(msg) 7 | local pc=io.popen("logger -p error -t linknxwrite "..msg) 8 | if pc then pc:close() end 9 | end 10 | 11 | function linknxwrite_logger_info(msg) 12 | local pc=io.popen("logger -p info -t linknxwrite "..msg) 13 | if pc then pc:close() end 14 | end 15 | 16 | local name = arg[1] 17 | local value = arg[2] 18 | 19 | if not name then 20 | linknxwrite_logger_err("no varname") 21 | return 22 | end 23 | 24 | if not value then 25 | linknxwrite_logger_err(name.." no value") 26 | return 27 | end 28 | 29 | local config=string.gsub(name,"^(.-)%..*$","%1") 30 | local section=string.gsub(name,"^.*%.(.-)$","%1") 31 | local state = uci.cursor(nil, "/var/state") 32 | local cfgvalue = state:get(config, section, "value") or "0" 33 | local type = state:get(config, section, "type") 34 | local oldvalue 35 | if type and type ~= "1.001" and ( value == "on" or value == "off" ) then 36 | if value == "off" then 37 | value = 0 38 | oldvalue = cfgvalue 39 | else 40 | if cfgvalue == "0" then 41 | value = state:get(config, section, "oldvalue") or "100" 42 | if value == "0" then value = "100" end 43 | else 44 | value = cfgvalue 45 | end 46 | end 47 | end 48 | if value == cfgvalue then 49 | linknxwrite_logger_info(name.." no change of value "..value.."/"..cfgvalue) 50 | return 51 | end 52 | local s = nixio.socket('inet', 'stream', none) 53 | s:connect('localhost','1028') 54 | --s = nixio.socket('unix', 'stream', none) 55 | --s:connect('/var/run/linknx') 56 | s:send("\r\n\4") 57 | s:close() 58 | 59 | local x = uci.cursor() 60 | local comment=x:get(config, section, "Name") 61 | local maingrp=x:get(config, "main_group", "Name") 62 | local middlegrp=x:get(config, "middle_group", "Name") 63 | local topic=maingrp.."/"..middlegrp.."/"..comment 64 | 65 | local state = uci.cursor(nil, "/var/state") 66 | state:set(config, section, "value", value) 67 | if oldvalue then 68 | state:set(config, section, "oldvalue", oldvalue) 69 | end 70 | state:save(config) 71 | nixio.fs.chmod("/var/state/"..config,644) 72 | -------------------------------------------------------------------------------- /linknx-uci/files/usr/sbin/linknxsubsscribemqtt.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | require "uci" 4 | mqtt = require "mosquitto" 5 | json = require "luci.jsonc" 6 | 7 | function sub_logger_err(msg) 8 | local pc=io.popen("logger -p error -t mqtt-sub "..msg) 9 | if pc then pc:close() end 10 | end 11 | 12 | function sub_logger_info(msg) 13 | local pc=io.popen("logger -p info -t mqtt-sub "..msg) 14 | if pc then pc:close() end 15 | end 16 | 17 | mclient = mqtt.new() 18 | x = uci.cursor() 19 | state = uci.cursor(nil, "/var/state") 20 | dp={} 21 | grp={} 22 | 23 | mclient.ON_CONNECT = function() 24 | for i=0,31 do 25 | for j=0,7 do 26 | local groupname="knx_"..i.."_"..j 27 | local f = io.open("/etc/config/"..groupname,"r") 28 | if f~=nil then 29 | io.close(f) 30 | maingrp = x:get(groupname,"main_group", "Name") 31 | middlegrp = x:get(groupname,"middle_group", "Name") 32 | x:foreach(groupname, "grp", function(s) 33 | local name = groupname.."."..s['.name'] 34 | local comment = s.Name 35 | local type = s.type 36 | if not type then 37 | sub_logger_err("no DPTs "..name.." "..comment) 38 | return 39 | end 40 | topic=maingrp.."/"..middlegrp.."/"..comment 41 | mclient:subscribe(topic) 42 | dp[topic] = { config=groupname, section=s['.name'] } 43 | end) 44 | end 45 | end 46 | end 47 | mclient:subscribe("homebridge/from/set") 48 | end 49 | mclient.ON_MESSAGE = function(mid, topic, payload) 50 | if topic and dp[topic] then 51 | local config = dp[topic].config 52 | local section = dp[topic].section 53 | local value = payload 54 | local name = config.."."..section 55 | sub_logger_info(name.."/"..value.."/"..topic) 56 | --arg={ name, value } 57 | --assert(loadfile("/usr/bin/linknxwritevalue.lua"))(name,value) 58 | local pc=io.popen("/usr/bin/linknxwritevalue.lua \""..name.."\" \""..value.."\"") 59 | if pc then pc:close() end 60 | elseif topic and topic == "homebridge/from/set" then 61 | local valuejs = json.parse(payload) 62 | local name = valuejs.name 63 | local value 64 | if valuejs.characteristic == "On" then 65 | if valuejs.value then 66 | value = "on" 67 | else 68 | value = "off" 69 | end 70 | end 71 | if valuejs.characteristic == "Brightness" then 72 | value = valuejs.value 73 | end 74 | if value then 75 | sub_logger_info(name.."/"..value.."/"..topic) 76 | --arg={ name, value } 77 | --assert(loadfile("/usr/bin/linknxwritevalue.lua"))(name,value) 78 | local pc=io.popen("/usr/bin/linknxwritevalue.lua \""..name.."\" \""..value.."\"") 79 | if pc then pc:close() end 80 | end 81 | end 82 | end 83 | mhost=x:get("linknx_mqtt", "mqtt", "host") 84 | mport=x:get("linknx_mqtt", "mqtt", "port") 85 | muser=x:get("linknx_mqtt", "mqtt", "user") 86 | mpw=x:get("linknx_mqtt", "mqtt", "pw") 87 | mclient:login_set(muser, mpw) 88 | mclient:connect(mhost, mport) 89 | mclient:loop_forever() 90 | -------------------------------------------------------------------------------- /luci-app-bacnet/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=luci-app-bacnet 4 | PKG_VERSION:=0.1.16 5 | PKG_RELEASE:=3 6 | PKG_BUILD_DEPENDS += LUCI_APP_BACNET_SRCDIET:luasrcdiet/host 7 | PKG_CONFIG_DEPENDS += CONFIG_LUCI_APP_BACNET_SRCDIET 8 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 9 | 10 | include $(INCLUDE_DIR)/package.mk 11 | 12 | define Package/luci-app-bacnet 13 | SECTION:=luci 14 | CATEGORY:=LuCI 15 | SUBMENU:=3. Applications 16 | TITLE:=Bacnet Device 17 | EXTRA_DEPENDS:=bacnet-stack-uci, luci-mod-admin-full 18 | endef 19 | 20 | define Package/luci-app-bacnet/config 21 | config LUCI_APP_BACNET_SRCDIET 22 | bool "bacnet Minify Lua sources" 23 | default n 24 | endef 25 | 26 | define SrcDiet 27 | $(FIND) $(1) -type f -name '*.lua' | while read src; do \ 28 | if LUA_PATH="$(STAGING_DIR_HOSTPKG)/lib/lua/5.1/?.lua" luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; \ 29 | then mv "$$$$src.o" "$$$$src"; fi; \ 30 | done 31 | endef 32 | 33 | define Build/Prepare 34 | mkdir -p $(PKG_BUILD_DIR) 35 | $(CP) ./luasrc $(PKG_BUILD_DIR)/ 36 | endef 37 | 38 | define Build/Configure 39 | endef 40 | 41 | define Build/Compile 42 | $(if $(CONFIG_LUCI_APP_BACNET_SRCDIET),$(call SrcDiet,$(PKG_BUILD_DIR)/luasrc/),true); 43 | endef 44 | 45 | define Package/luci-app-bacnet/postinst 46 | #!/bin/sh 47 | [ -n "${IPKG_INSTROOT}" ] || { 48 | rm -f /tmp/luci-indexcache 49 | exit 0 50 | } 51 | endef 52 | 53 | define Package/luci-app-bacnet/install 54 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller 55 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/controller/* $(1)/usr/lib/lua/luci/controller 56 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/bacnet 57 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/model/cbi/bacnet/* $(1)/usr/lib/lua/luci/model/cbi/bacnet 58 | endef 59 | 60 | $(eval $(call BuildPackage,luci-app-bacnet)) 61 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/controller/bacnet.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | module("luci.controller.bacnet", package.seeall) 15 | 16 | function index() 17 | if not nixio.fs.access("/etc/config/bacnet_dev") then 18 | return 19 | end 20 | entry({"admin", "bacnet"}, alias("admin", "bacnet", "bacnet_dev"), _("Bacnet"), 40).index = true 21 | local page = entry({"admin", "bacnet", "bacnet_dev"}, cbi("bacnet/bacnet_dev"), "Bacnet Device", 20) 22 | page.dependent = true 23 | local page = entry({"admin", "bacnet", "bacnet_ai"}, cbi("bacnet/bacnet_ai"), "Analog Input", 21) 24 | page.dependent = true 25 | local page = entry({"admin", "bacnet", "bacnet_ao"}, cbi("bacnet/bacnet_ao"), "Analog Output", 22) 26 | page.dependent = true 27 | local page = entry({"admin", "bacnet", "bacnet_av"}, cbi("bacnet/bacnet_av"), "Analog Value", 23) 28 | page.dependent = true 29 | local page = entry({"admin", "bacnet", "bacnet_bi"}, cbi("bacnet/bacnet_bi"), "Binary Input", 24) 30 | page.dependent = true 31 | local page = entry({"admin", "bacnet", "bacnet_bo"}, cbi("bacnet/bacnet_bo"), "Binary Output", 25) 32 | page.dependent = true 33 | local page = entry({"admin", "bacnet", "bacnet_bv"}, cbi("bacnet/bacnet_bv"), "Binary Value", 26) 34 | page.dependent = true 35 | local page = entry({"admin", "bacnet", "bacnet_mi"}, cbi("bacnet/bacnet_mi"), "Multisate Input", 27) 36 | page.dependent = true 37 | local page = entry({"admin", "bacnet", "bacnet_mo"}, cbi("bacnet/bacnet_mo"), "Multisate Output", 28) 38 | page.dependent = true 39 | local page = entry({"admin", "bacnet", "bacnet_mv"}, cbi("bacnet/bacnet_mv"), "Multisate Value", 29) 40 | page.dependent = true 41 | local page = entry({"admin", "bacnet", "bacnet_nc"}, cbi("bacnet/bacnet_nc"), "Notification Class", 30) 42 | page.dependent = true 43 | local page = entry({"admin", "bacnet", "bacnet_tl"}, cbi("bacnet/bacnet_tl"), "Trendlog", 31) 44 | page.dependent = true 45 | 46 | local page = entry({"admin", "bacnet", "bacnetgroups"}, cbi("bacnet/groups", {autoapply=false}), "Bacnet Groups", 32) 47 | page.dependent = true 48 | end 49 | 50 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_ao.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_ao") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_ao") then 25 | return 26 | end 27 | end 28 | 29 | local events = {} 30 | events[1] = {0,"Keine Ereignis Behandlung"} 31 | events[2] = {1,"Ereignis"} 32 | events[3] = {2,"Ereignis"} 33 | events[4] = {3,"Ereignis"} 34 | events[5] = {4,"Ereignis"} 35 | events[6] = {5,"Ereignis"} 36 | events[7] = {6,"Ereignis"} 37 | events[8] = {7,"Alle Ereignis behandeln"} 38 | 39 | local limits = {} 40 | limits[1] = {0,"Keine Limits"} 41 | limits[2] = {1,"Low"} 42 | limits[3] = {2,"High"} 43 | limits[4] = {3,"Low High"} 44 | 45 | --if arg1 then 46 | -- m = Map("bacnet_ao_"..arg1, "Bacnet Analog Output", "Bacnet Analog Output Configuration") 47 | --else 48 | m = Map("bacnet_ao", "Bacnet Analog Output", "Bacnet Analog Output Configuration") 49 | --end 50 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 51 | 52 | local s = m:section(TypedSection, "ao", arg1 or 'Index') 53 | s.addremove = true 54 | s.anonymous = false 55 | --s.template = "cbi/tblsection" 56 | s:tab("main","Standard") 57 | s:tab("adv","Erweitert") 58 | s:tab("io","Zugrifsname") 59 | 60 | s:taboption("main",Flag, "disable", "Disable") 61 | s:taboption("main",Flag, "Out_Of_Service", "Out Of Service").rmempty = false 62 | s:taboption("main",Value, "name", "Name") 63 | 64 | local sva = s:taboption("io", Value, "tagname", "Zugrifsname") 65 | uci:foreach("linknx", "station", 66 | function (section) 67 | sva:value(section.tagname) 68 | end) 69 | uci:foreach("modbus", "station", 70 | function (section) 71 | sva:value(section.tagname) 72 | end) 73 | 74 | local sva = s:taboption("main", Value, "min_value", "Min Present Value") 75 | sva.placeholder = 0 76 | local sva = s:taboption("main", Value, "max_value", "Max Present Value") 77 | sva.placeholder = 100 78 | 79 | local sva = s:taboption("io", Value, "unit_id", "Unit ID") 80 | sva.placeholder = 1 81 | sva.datatype = "range(1, 255)" 82 | sva.rmempty = true 83 | local sva = s:taboption("io", ListValue, "func", "Funktions Code") 84 | sva:value('',"Halteregister (Holding Register) Default") 85 | sva:value('1',"Spulen (Coils)") 86 | sva:value('2',"Diskrete Eingäng (Disc Inputs)") 87 | sva:value('3',"Halteregister (Holding Register)") 88 | sva:value('4',"Eingaberegister (Input Register)") 89 | sva.rmempty = true 90 | local sva = s:taboption("io", Value, "addr", "Addr") 91 | sva.placeholder = 1 92 | sva.datatype = "string" 93 | local sva = s:taboption("io", ListValue, "dpt", "Datapoint Types defined in KNX standard") 94 | sva:value("","none") 95 | sva:value("1.001","1.001 switching (on/off) (EIS1)") 96 | sva:value("3.007","3.007 dimming (control of dimmer using up/down/stop) (EIS2)") 97 | sva:value("3.008","3.008 blinds (control of blinds using close/open/stop)") 98 | sva:value("5.xxx","5.xxx 8bit unsigned integer (from 0 to 255) (EIS6)") 99 | sva:value("5.001","5.001 scaling (from 0 to 100%)") 100 | sva:value("5.003","5.003 angle (from 0 to 360°)") 101 | sva:value("6.xxx","6.xxx 8bit signed integer (EIS14)") 102 | sva:value("7.xxx","7.xxx 16bit unsigned integer (EIS10)") 103 | sva:value("8.xxx","8.xxx 16bit signed integer") 104 | sva:value("9.xxx","9.xxx 16 bit floating point number (EIS5)") 105 | sva:value("10.001","10.001 time (EIS3)") 106 | sva:value("11.001","11.001 date (EIS4)") 107 | sva:value("12.xxx","12.xxx 32bit unsigned integer (EIS11)") 108 | sva:value("13.xxx","13.xxx 32bit signed integer") 109 | sva:value("14.xxx","14.xxx 32 bit IEEE 754 floating point number") 110 | sva:value("16.000","16.000 string (max 14 ASCII chars restricted to ASCII codes 0..127) (EIS15)") 111 | sva:value("16.001","16.001 string (max 14 ASCII chars in range 0..255)") 112 | sva:value("20.102","20.102 heating mode (auto/comfort/standby/night/frost)") 113 | sva:value("28.001","28.001 variable length string object") 114 | sva:value("29.xxx","29.xxx signed 64bit value") 115 | sva.rmempty = true 116 | 117 | local sva = s:taboption("io", Flag, "unsigned", "Ohne Vorzeichen (z.B. Zähler)") 118 | 119 | 120 | local sva = s:taboption("main", Value, "value", "Value") 121 | sva.rmempty = false 122 | 123 | local sva = s:taboption("main", Value, "si_unit", "Einheit") 124 | sva:value("95","Keine Einheit") 125 | sva:value("98","Prozent") 126 | sva:value("62","Grad Celsius") 127 | sva:value("63","Grad Kelvin") 128 | sva:value("53","Pascal") 129 | sva:value("134","mbar") 130 | sva:value("27","Hz") 131 | sva:value("80","m^3") 132 | sva:value("82","L") 133 | sva:value("18","Wh") 134 | sva:value("19","kWh") 135 | sva:value("146","MWh") 136 | sva:value("132","mW") 137 | sva:value("47","W") 138 | sva:value("48","kW") 139 | sva:value("49","MW") 140 | sva:value("85","m^3/s") 141 | sva:value("86","m^3/min") 142 | sva:value("87","m^3/min") 143 | 144 | 145 | local sva = s:taboption("main", ListValue, "group", "Gruppe") 146 | local uci = luci.model.uci.cursor() 147 | uci:foreach("bacnet_group", "group", 148 | function (section) 149 | sva:value(section.name) 150 | end) 151 | 152 | s:taboption("main", Value, "description", "Anzeige Name") 153 | s:taboption("adv", Flag, "tl", "Trend Log") 154 | local sva = s:taboption("adv", Value, "nc", "Notification Class") 155 | sva.rmempty = true 156 | local uci = luci.model.uci.cursor() 157 | uci:foreach("bacnet_nc", "nc", 158 | function (section) 159 | sva:value(section[".name"],section.name) 160 | end) 161 | local sva = s:taboption("adv", Value, "event", "BIT1 Alarm,BIT2 Fehler,BIT3 Alarm oder Fehler geht [7]") 162 | for i, v in ipairs(events) do 163 | sva:value(v[1],v[1]..": "..v[2]) 164 | end 165 | 166 | local sva = s:taboption("adv", Value, "cov_increment", "cov_increment") 167 | sva:value("0.1") 168 | local sva = s:taboption("adv", Value, "limit", "limit") 169 | for i, v in ipairs(limits) do 170 | sva:value(v[1],v[1]..": "..v[2]) 171 | end 172 | local sva = s:taboption("adv", Value, "low_limit", "low_limit") 173 | sva:value("0") 174 | local sva = s:taboption("adv", Value, "high_limit", "high_limit") 175 | sva:value("100") 176 | local sva = s:taboption("adv", Value, "dead_limit", "dead_limit") 177 | sva:value("0") 178 | local sva = s:taboption("adv", Value, "value_time", "value_time") 179 | 180 | return m 181 | 182 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_bi.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_bi") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_bi") then 25 | return 26 | end 27 | end 28 | 29 | local events = {} 30 | events[1] = {0,"Keine Ereignis Behandlung"} 31 | events[2] = {1,"Ereignis"} 32 | events[3] = {2,"Ereignis"} 33 | events[4] = {3,"Ereignis"} 34 | events[5] = {4,"Ereignis"} 35 | events[6] = {5,"Ereignis"} 36 | events[7] = {6,"Ereignis"} 37 | events[8] = {7,"Alle Ereignis behandeln"} 38 | 39 | --if arg1 then 40 | -- m = Map("bacnet_bi_"..arg1, "Bacnet Binary Input", "Bacnet Binary Input Configuration") 41 | --else 42 | m = Map("bacnet_bi", "Bacnet Binary Input", "Bacnet Binary Input Configuration") 43 | --end 44 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 45 | 46 | local s = m:section(TypedSection, "bi", arg1 or 'Index') 47 | s.addremove = true 48 | s.anonymous = false 49 | --s.template = "cbi/tblsection" 50 | s:tab("main","Standard") 51 | s:tab("adv","Erweitert") 52 | s:tab("io","Zugrifsname") 53 | 54 | s:taboption("main",Flag, "disable", "Disable") 55 | s:taboption("main",Flag, "Out_Of_Service", "Out Of Service").rmempty = false 56 | s:taboption("main",Value, "name", "Name") 57 | 58 | local sva = s:taboption("io", Value, "tagname", "Zugrifsname") 59 | uci:foreach("linknx", "station", 60 | function (section) 61 | sva:value(section.tagname) 62 | end) 63 | uci:foreach("modbus", "station", 64 | function (section) 65 | sva:value(section.tagname) 66 | end) 67 | uci:foreach("mbus", "station", 68 | function (section) 69 | sva:value(section.tagname) 70 | end) 71 | 72 | local sva = s:taboption("io", Value, "unit_id", "Unit ID") 73 | sva.placeholder = 1 74 | sva.datatype = "range(1, 255)" 75 | sva.rmempty = true 76 | local sva = s:taboption("io", ListValue, "func", "Funktions Code") 77 | sva:value('',"Diskrete Eingäng (Disc Inputs) Default") 78 | sva:value('1',"Spulen (Coils)") 79 | sva:value('2',"Diskrete Eingäng (Disc Inputs)") 80 | sva:value('3',"Halteregister (Holding Register)") 81 | sva:value('4',"Eingaberegister (Input Register)") 82 | sva.rmempty = true 83 | local sva = s:taboption("io", Value, "addr", "Addr") 84 | sva.placeholder = 1 85 | sva.datatype = "string" 86 | local sva = s:taboption("io", ListValue, "resolution", "Auflösung") 87 | sva:value("","1 Bit Default") 88 | sva:value("dword","1 Bit aus 1 Register") 89 | sva:value("bit","1 Bit") 90 | sva.rmempty = true 91 | local sva = s:taboption("io", ListValue, "bit", "Bit 0-15") 92 | sva:depends("resolution","dword") 93 | sva:value("","Bit 0 Default") 94 | sva:value("0","Bit 0") 95 | sva:value("1","Bit 1") 96 | sva:value("2","Bit 2") 97 | sva:value("3","Bit 3") 98 | sva:value("4","Bit 4") 99 | sva:value("5","Bit 5") 100 | sva:value("6","Bit 6") 101 | sva:value("7","Bit 7") 102 | sva:value("8","Bit 8") 103 | sva:value("9","Bit 9") 104 | sva:value("10","Bit 10") 105 | sva:value("11","Bit 11") 106 | sva:value("12","Bit 12") 107 | sva:value("13","Bit 13") 108 | sva:value("14","Bit 14") 109 | sva:value("15","Bit 15") 110 | sva.rmempty = true 111 | local sva = s:taboption("io", ListValue, "dpt", "Datapoint Types defined in KNX standard") 112 | sva:value("","none") 113 | sva:value("1.001","1.001 switching (on/off) (EIS1)") 114 | sva.rmempty = true 115 | 116 | local sva = s:taboption("main", Flag, "value", "Value") 117 | sva.rmempty = false 118 | 119 | local sva = s:taboption("adv", Flag, "alarm_value", "Alarm Value") 120 | sva.rmempty = false 121 | 122 | local sva = s:taboption("main", Value, "group", "Gruppe") 123 | local uci = luci.model.uci.cursor() 124 | uci:foreach("bacnet_group", "group", 125 | function (section) 126 | sva:value(section.name) 127 | end) 128 | 129 | local sva = s:taboption("main", Value, "description", "Anzeige Name") 130 | 131 | local sva = s:taboption("adv", Value, "inactive", "Inactive Text") 132 | 133 | local sva = s:taboption("adv", Value, "active", "Active Text") 134 | 135 | local sva = s:taboption("adv", Flag, "tl", "Trend Log") 136 | 137 | local sva = s:taboption("adv", Value, "nc", "Notification Class") 138 | local uci = luci.model.uci.cursor() 139 | uci:foreach("bacnet_nc", "nc", 140 | function (section) 141 | sva:value(section[".name"],section.name) 142 | end) 143 | 144 | local sva = s:taboption("adv", Value, "event", "BIT1 Alarm,BIT2 Fehler,BIT3 Alarm oder Fehler geht [7]") 145 | for i, v in ipairs(events) do 146 | sva:value(v[1],v[1]..": "..v[2]) 147 | end 148 | 149 | local sva = s:taboption("adv", Value, "time_delay", "Zeitverzoegerung in sec") 150 | local sva = s:taboption("adv", Value, "value_time", "value_time") 151 | 152 | return m 153 | 154 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_bo.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_bo") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_bo") then 25 | return 26 | end 27 | end 28 | 29 | local events = {} 30 | events[1] = {0,"Keine Ereignis Behandlung"} 31 | events[2] = {1,"Ereignis"} 32 | events[3] = {2,"Ereignis"} 33 | events[4] = {3,"Ereignis"} 34 | events[5] = {4,"Ereignis"} 35 | events[6] = {5,"Ereignis"} 36 | events[7] = {6,"Ereignis"} 37 | events[8] = {7,"Alle Ereignis behandeln"} 38 | 39 | --if arg1 then 40 | -- m = Map("bacnet_bo_"..arg1, "Binary Output Value", "Bacnet Binary Output Configuration") 41 | --else 42 | m = Map("bacnet_bo", "Bacnet Binary Ouput", "Bacnet Binary Output Configuration") 43 | --end 44 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 45 | 46 | local s = m:section(TypedSection, "bo", arg1 or 'Index') 47 | s.addremove = true 48 | s.anonymous = false 49 | --s.template = "cbi/tblsection" 50 | s:tab("main","Standard") 51 | s:tab("adv","Erweitert") 52 | s:tab("io","Zugrifsname") 53 | 54 | s:taboption("main",Flag, "disable", "Disable") 55 | s:taboption("main",Flag, "Out_Of_Service", "Out Of Service").rmempty = false 56 | s:taboption("main",Value, "name", "Name") 57 | 58 | local sva = s:taboption("io", Value, "tagname", "Zugrifsname") 59 | uci:foreach("linknx", "station", 60 | function (section) 61 | sva:value(section.tagname) 62 | end) 63 | uci:foreach("modbus", "station", 64 | function (section) 65 | sva:value(section.tagname) 66 | end) 67 | uci:foreach("mbus", "station", 68 | function (section) 69 | sva:value(section.tagname) 70 | end) 71 | 72 | local sva = s:taboption("io", Value, "unit_id", "Unit ID") 73 | sva.placeholder = 1 74 | sva.datatype = "range(1, 255)" 75 | sva.rmempty = true 76 | local sva = s:taboption("io", ListValue, "func", "Funktions Code") 77 | sva:value('',"Spulen (Coils) Default") 78 | sva:value('1',"Spulen (Coils)") 79 | sva:value('2',"Diskrete Eingäng (Disc Inputs)") 80 | sva:value('3',"Halteregister (Holding Register)") 81 | sva:value('4',"Eingaberegister (Input Register)") 82 | sva.rmempty = true 83 | local sva = s:taboption("io", Value, "addr", "Addr") 84 | sva.placeholder = 1 85 | sva.datatype = "string" 86 | local sva = s:taboption("io", ListValue, "resolution", "Auflösung") 87 | sva:value("","1 Bit Default") 88 | sva:value("dword","1 Bit aus 1 Register") 89 | sva:value("bit","1 Bit") 90 | sva.rmempty = true 91 | local sva = s:taboption("io", ListValue, "bit", "Bit 0-15") 92 | sva:depends("resolution","dword") 93 | sva:value("","Bit 0 Default") 94 | sva:value("0","Bit 0") 95 | sva:value("1","Bit 1") 96 | sva:value("2","Bit 2") 97 | sva:value("3","Bit 3") 98 | sva:value("4","Bit 4") 99 | sva:value("5","Bit 5") 100 | sva:value("6","Bit 6") 101 | sva:value("7","Bit 7") 102 | sva:value("8","Bit 8") 103 | sva:value("9","Bit 9") 104 | sva:value("10","Bit 10") 105 | sva:value("11","Bit 11") 106 | sva:value("12","Bit 12") 107 | sva:value("13","Bit 13") 108 | sva:value("14","Bit 14") 109 | sva:value("15","Bit 15") 110 | sva.rmempty = true 111 | local sva = s:taboption("io", ListValue, "dpt", "Datapoint Types defined in KNX standard") 112 | sva:value("","none") 113 | sva:value("1.001","1.001 switching (on/off) (EIS1)") 114 | sva.rmempty = true 115 | 116 | local sva = s:taboption("main", Flag, "value", "Value") 117 | sva.rmempty = false 118 | 119 | local sva = s:taboption("main", Flag, "fb_value", "Feedback Value") 120 | sva.rmempty = false 121 | 122 | local sva = s:taboption("main", Value, "group", "Gruppe") 123 | local uci = luci.model.uci.cursor() 124 | uci:foreach("bacnet_group", "group", 125 | function (section) 126 | sva:value(section.name) 127 | end) 128 | 129 | local sva = s:taboption("main", Value, "description", "Anzeige Name") 130 | 131 | local sva = s:taboption("adv", Value, "inactive", "Inactive Text") 132 | 133 | local sva = s:taboption("adv", Value, "active", "Active Text") 134 | 135 | local sva = s:taboption("adv", Flag, "tl", "Trend Log") 136 | 137 | local sva = s:taboption("adv", Value, "nc", "Notification Class") 138 | local uci = luci.model.uci.cursor() 139 | uci:foreach("bacnet_nc", "nc", 140 | function (section) 141 | sva:value(section[".name"],section.name) 142 | end) 143 | 144 | local sva = s:taboption("adv", Value, "event", "BIT1 Alarm,BIT2 Fehler,BIT3 Alarm oder Fehler geht [7]") 145 | for i, v in ipairs(events) do 146 | sva:value(v[1],v[1]..": "..v[2]) 147 | end 148 | 149 | local sva = s:taboption("adv", Value, "time_delay", "Zeitverzoegerung in sec") 150 | local sva = s:taboption("adv", Value, "value_time", "value_time") 151 | 152 | return m 153 | 154 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_bv.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_bv") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_bv") then 25 | return 26 | end 27 | end 28 | 29 | local events = {} 30 | events[1] = {0,"Keine Ereignis Behandlung"} 31 | events[2] = {1,"Ereignis"} 32 | events[3] = {2,"Ereignis"} 33 | events[4] = {3,"Ereignis"} 34 | events[5] = {4,"Ereignis"} 35 | events[6] = {5,"Ereignis"} 36 | events[7] = {6,"Ereignis"} 37 | events[8] = {7,"Alle Ereignis behandeln"} 38 | 39 | --if arg1 then 40 | -- m = Map("bacnet_bv_"..arg1, "Bacnet Binary Value", "Bacnet Binary Value Configuration") 41 | --else 42 | m = Map("bacnet_bv", "Bacnet Binary Value", "Bacnet Binary Value Configuration") 43 | --end 44 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 45 | 46 | local s = m:section(TypedSection, "bv", arg1 or 'Index') 47 | s.addremove = true 48 | s.anonymous = false 49 | --s.template = "cbi/tblsection" 50 | s:tab("main","Standard") 51 | s:tab("adv","Erweitert") 52 | s:tab("io","Zugrifsname") 53 | 54 | s:taboption("main",Flag, "disable", "Disable") 55 | s:taboption("main",Flag, "Out_Of_Service", "Out Of Service").rmempty = false 56 | s:taboption("main",Value, "name", "Name") 57 | 58 | local sva = s:taboption("io", Value, "tagname", "Zugrifsname") 59 | uci:foreach("linknx", "station", 60 | function (section) 61 | sva:value(section.tagname) 62 | end) 63 | uci:foreach("modbus", "station", 64 | function (section) 65 | sva:value(section.tagname) 66 | end) 67 | uci:foreach("mbus", "station", 68 | function (section) 69 | sva:value(section.tagname) 70 | end) 71 | 72 | local sva = s:taboption("io", Value, "unit_id", "Unit ID") 73 | sva.placeholder = 1 74 | sva.datatype = "range(1, 255)" 75 | sva.rmempty = true 76 | local sva = s:taboption("io", ListValue, "func", "Funktions Code") 77 | sva:value('',"Spulen (Coils) Default") 78 | sva:value('1',"Spulen (Coils)") 79 | sva:value('2',"Diskrete Eingäng (Disc Inputs)") 80 | sva:value('3',"Halteregister (Holding Register)") 81 | sva:value('4',"Eingaberegister (Input Register)") 82 | sva.rmempty = true 83 | local sva = s:taboption("io", Value, "addr", "Addr") 84 | sva.placeholder = 1 85 | sva.datatype = "string" 86 | local sva = s:taboption("io", ListValue, "resolution", "Auflösung") 87 | sva:value("","1 Bit Default") 88 | sva:value("dword","1 Bit aus 1 Register") 89 | sva:value("bit","1 Bit") 90 | sva.rmempty = true 91 | local sva = s:taboption("io", ListValue, "bit", "Bit 0-15") 92 | sva:depends("resolution","dword") 93 | sva:value("","Bit 0 Default") 94 | sva:value("0","Bit 0") 95 | sva:value("1","Bit 1") 96 | sva:value("2","Bit 2") 97 | sva:value("3","Bit 3") 98 | sva:value("4","Bit 4") 99 | sva:value("5","Bit 5") 100 | sva:value("6","Bit 6") 101 | sva:value("7","Bit 7") 102 | sva:value("8","Bit 8") 103 | sva:value("9","Bit 9") 104 | sva:value("10","Bit 10") 105 | sva:value("11","Bit 11") 106 | sva:value("12","Bit 12") 107 | sva:value("13","Bit 13") 108 | sva:value("14","Bit 14") 109 | sva:value("15","Bit 15") 110 | sva.rmempty = true 111 | local sva = s:taboption("io", ListValue, "dpt", "Datapoint Types defined in KNX standard") 112 | sva:value("","none") 113 | sva:value("1.001","1.001 switching (on/off) (EIS1)") 114 | sva.rmempty = true 115 | 116 | local sva = s:taboption("main", Flag, "value", "Value") 117 | sva.rmempty = false 118 | 119 | local sva = s:taboption("adv", Flag, "alarm_value", "Alarm Value") 120 | sva.rmempty = false 121 | 122 | local sva = s:taboption("main", Value, "group", "Gruppe") 123 | local uci = luci.model.uci.cursor() 124 | uci:foreach("bacnet_group", "group", 125 | function (section) 126 | sva:value(section.name) 127 | end) 128 | 129 | local sva = s:taboption("main", Value, "description", "Anzeige Name") 130 | 131 | local sva = s:taboption("adv", Value, "inactive", "Inactive Text") 132 | 133 | local sva = s:taboption("adv", Value, "active", "Active Text") 134 | 135 | local sva = s:taboption("adv", Flag, "tl", "Trend Log") 136 | 137 | local sva = s:taboption("adv", Value, "nc", "Notification Class") 138 | local uci = luci.model.uci.cursor() 139 | uci:foreach("bacnet_nc", "nc", 140 | function (section) 141 | sva:value(section[".name"],section.name) 142 | end) 143 | 144 | local sva = s:taboption("adv", Value, "event", "BIT1 Alarm,BIT2 Fehler,BIT3 Alarm oder Fehler geht [7]") 145 | for i, v in ipairs(events) do 146 | sva:value(v[1],v[1]..": "..v[2]) 147 | end 148 | 149 | local sva = s:taboption("adv", Value, "time_delay", "Zeitverzoegerung in sec") 150 | local sva = s:taboption("adv", Value, "value_time", "value_time") 151 | 152 | return m 153 | 154 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_dev.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | local fs = require "nixio.fs" 16 | local lfs = require "nixio.fs" 17 | local uci = require "luci.model.uci".cursor() 18 | local sys = require "luci.sys" 19 | local uci_state = require "luci.model.uci".cursor_state() 20 | 21 | if not lfs.access("/etc/config/bacnet_dev") then 22 | if not sys.exec("touch /etc/config/bacnet_dev") then 23 | return 24 | end 25 | end 26 | 27 | local m = Map("bacnet_dev", "Bacnet Device", "Bacnet Device Configuration") 28 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 29 | 30 | 31 | 32 | local s = m:section(TypedSection, "dev", 'Device Nummer') 33 | s.addremove = true 34 | s.anonymous = false 35 | 36 | s:option(DummyValue, "dv1", nil, "supported Netzwerk Layers are:") 37 | s:option(DummyValue, "dv1", nil, "BACnetIPv4 opkg install bacnet-stack-bip") 38 | s:option(DummyValue, "dv1", nil, "BACnetIPv6 opkg #WIP") 39 | s:option(DummyValue, "dv1", nil, "BACnet Ethernet (linklocal and fast) opkg install bacnet-stack-ethernet") 40 | s:option(DummyValue, "dv1", nil, "BACnet MSTP (serial RS485) opkg install bacnet-stack-mstp") 41 | 42 | -- local active = s:option(DummyValue, "_active", translate("Started") ) 43 | -- function active.cfgvalue(self, section) 44 | -- local pid = fs.readfile("/var/run/bacserv-%s.pid" % section) 45 | -- if pid and #pid > 0 and tonumber(pid) ~= nil then 46 | -- return (sys.process.signal(pid, 0)) 47 | -- and translatef("yes (%i)", pid) 48 | -- or translate("no") 49 | -- end 50 | -- return translate("no").." "..section 51 | -- end 52 | 53 | -- local updown = s:option(Button, "_updown", translate("Start/Stop") ) 54 | -- updown._state = false 55 | -- function updown.cbid(self, section) 56 | -- local pid = fs.readfile("/var/run/bacserv-%s.pid" % section) 57 | -- self._state = pid and #pid > 0 and sys.process.signal(pid, 0) 58 | -- self.option = self._state and "stop" or "start" 59 | -- 60 | -- return AbstractValue.cbid(self, section) 61 | -- end 62 | -- function updown.cfgvalue(self, section) 63 | -- self.title = self._state and "stop" or "start" 64 | -- self.inputstyle = self._state and "reset" or "reload" 65 | -- end 66 | -- function updown.write(self, section, value) 67 | -- if self.option == "stop" then 68 | -- sys.call("/etc/init.d/bacserv stop %s" % section) 69 | -- else 70 | -- sys.call("/etc/init.d/bacserv start %s" % section) 71 | -- end 72 | -- end 73 | 74 | s:option(Flag, "enable", "enable") 75 | 76 | if lfs.access("/usr/sbin/bacserv-router") then 77 | s:option(Flag, "enable_rt", "enable_rt","Routing Port") 78 | end 79 | 80 | sva = s:option(Value, "bacdl", "Netzwerk Layer") 81 | if lfs.access("/usr/sbin/bacserv-bip") or lfs.access("/usr/sbin/bacserv-router") then 82 | sva:value('bip','BACnet IPv4') 83 | end 84 | if lfs.access("/usr/sbin/bacserv-bip6") then 85 | sva:value('bip6','BACnet IPv6') 86 | end 87 | if lfs.access("/usr/sbin/bacserv-ethernet") then 88 | sva:value('ethernet','BACnet Ethernet') 89 | end 90 | if lfs.access("/usr/sbin/bacserv-mstp") or lfs.access("/usr/sbin/bacserv-router") then 91 | sva:value('mstp','BACnet MSTP (RS485/RS232)') 92 | end 93 | 94 | 95 | sva = s:option(Value, "iface", "Netzwerk Interface") 96 | uci:foreach("network", "interface", 97 | function(section) 98 | sva:value(section[".name"]) 99 | end) 100 | if lfs.access("/usr/sbin/bacserv-mstp") or lfs.access("/usr/sbin/bacserv-router") then 101 | for device in nixio.fs.glob("/dev/ttyS[0-9]*") do 102 | sva:value(device) 103 | end 104 | for device in nixio.fs.glob("/dev/ttyUSB[0-9]*") do 105 | sva:value(device) 106 | end 107 | end 108 | 109 | sva = s:option(Value, "port", "UDP Port") 110 | sva:depends("bacdl","bip") 111 | sva.placeholder = 47808 112 | sva.datatype = "portrange" 113 | sva = s:option(Value, "mac", "MAC Addresse") 114 | sva:depends("bacdl","mstp") 115 | sva.placeholder = 127 116 | sva.datatype = "range(0, 128)" 117 | sva.rmempty = true 118 | sva = s:option(Value, "max_master", "Max Master") 119 | sva:depends("bacdl","mstp") 120 | sva.placeholder = 127 121 | sva.datatype = "range(0, 128)" 122 | sva.rmempty = true 123 | sva = s:option(Value, "max_frames", "Max Frames") 124 | sva:depends("bacdl","mstp") 125 | sva.placeholder = 1 126 | sva.datatype = "range(1, 128)" 127 | sva.rmempty = true 128 | sva = s:option(ListValue, "baud", "Uebertragungsrate") 129 | sva:value("","38400 Default") 130 | sva:value('9600') 131 | sva:value('19200') 132 | sva:value('38400') 133 | sva:value('57600') 134 | sva:value('115200') 135 | sva:depends("bacdl","mstp") 136 | sva.rmempty = true 137 | sva = s:option(ListValue, "parity_bit", "Parity Bit") 138 | sva:value('','None Default') 139 | sva:value('N','None') 140 | sva:value('O','Odd') 141 | sva:value('E','Even') 142 | sva:depends("bacdl","mstp") 143 | sva.rmempty = true 144 | sva = s:option(ListValue, "data_bit", "Data Bit") 145 | sva:value("","8 Default") 146 | sva:value(5) 147 | sva:value(6) 148 | sva:value(7) 149 | sva:value(8) 150 | sva:depends("bacdl","mstp") 151 | sva.rmempty = true 152 | sva = s:option(ListValue, "stop_bit", "Stop Bit") 153 | sva:value("","1 Default") 154 | sva:value(1) 155 | sva:value(2) 156 | sva:depends("bacdl","mstp") 157 | sva.rmempty = true 158 | 159 | sva = s:option(Value, "net", "Net") 160 | sva.placeholder = 0 161 | sva.datatype = "portrange" 162 | sva.rmempty = true 163 | 164 | sva = s:option(Value, "Id", "Device ID") 165 | sva.placeholder = 4711 166 | sva.datatype = "portrange" 167 | s:option(Value, "app_ver", "Device Version") 168 | s:option(Value, "name", "Device Name") 169 | s:option(Value, "modelname", "Model Name") 170 | 171 | s:option(Value, "description", "Anzeige Name") 172 | s:option(Value, "location", "Einbau Ort") 173 | 174 | return m 175 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_mi.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_mi") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_mi") then 25 | return 26 | end 27 | end 28 | 29 | local events = {} 30 | events[1] = {0,"Keine Ereignis Behandlung"} 31 | events[2] = {1,"Ereignis"} 32 | events[3] = {2,"Ereignis"} 33 | events[4] = {3,"Ereignis"} 34 | events[5] = {4,"Ereignis"} 35 | events[6] = {5,"Ereignis"} 36 | events[7] = {6,"Ereignis"} 37 | events[8] = {7,"Alle Ereignis behandeln"} 38 | 39 | --if arg1 then 40 | -- m = Map("bacnet_mi_"..arg1, "Bacnet Multistate Input", "Bacnet Multistate Input Configuration") 41 | --else 42 | m = Map("bacnet_mi", "Bacnet Multistate Input", "Bacnet Multistate Input Configuration") 43 | --end 44 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 45 | 46 | s = m:section(TypedSection, "mi", arg1 or 'Index') 47 | s.addremove = true 48 | s.anonymous = false 49 | s.template = "cbi/tblsection" 50 | 51 | s:option(Flag, "disable", "Disable") 52 | s:option(Flag, "Out_Of_Service", "Out Of Service") 53 | s:option(Value, "name", "Name") 54 | 55 | sva = s:option(Value, "tagname", "Zugrifsname") 56 | uci:foreach("linknx", "station", 57 | function (section) 58 | sva:value(section.tagname) 59 | end) 60 | uci:foreach("modbus", "station", 61 | function (section) 62 | sva:value(section.tagname) 63 | end) 64 | 65 | local sva = s:option(Value, "unit_id", "Unit ID") 66 | sva.placeholder = 1 67 | sva.datatype = "range(1, 255)" 68 | sva.rmempty = true 69 | local sva = s:option(ListValue, "func", "Funktions Code") 70 | sva:value("","Eingaberegister (Input Register) Default") 71 | sva:value('1',"Spulen (Coils)") 72 | sva:value('2',"Diskrete Eingäng (Disc Inputs)") 73 | sva:value('3',"Halteregister (Holding Register)") 74 | sva:value('4',"Eingaberegister (Input Register)") 75 | sva.rmempty = true 76 | local sva = s:option(Value, "addr", "Addr") 77 | sva.placeholder = 1 78 | sva.datatype = "string" 79 | local sva = s:option(ListValue, "dpt", "Datapoint Types defined in KNX standard") 80 | sva:value("","none") 81 | sva:value("1.001","1.001 switching (on/off) (EIS1)") 82 | sva:value("3.007","3.007 dimming (control of dimmer using up/down/stop) (EIS2)") 83 | sva:value("3.008","3.008 blinds (control of blinds using close/open/stop)") 84 | sva:value("5.xxx","5.xxx 8bit unsigned integer (from 0 to 255) (EIS6)") 85 | sva:value("7.xxx","7.xxx 16bit unsigned integer (EIS10)") 86 | sva:value("12.xxx","12.xxx 32bit unsigned integer (EIS11)") 87 | sva:value("20.102","20.102 heating mode (auto/comfort/standby/night/frost)") 88 | sva.rmempty = true 89 | 90 | s:option(Value, "value", "Value") 91 | s:option(DynamicList, "state", "Stats") 92 | s:option(DynamicList, "alarmstate", "Alarm Stats") 93 | 94 | sva = s:option(Value, "group", "Gruppe") 95 | local uci = luci.model.uci.cursor() 96 | uci:foreach("bacnet_group", "group", 97 | function (section) 98 | sva:value(section.name) 99 | end) 100 | 101 | s:option(Value, "description", "Anzeige Name") 102 | s:option(Flag, "tl", "Trend Log") 103 | svc = s:option(Value, "nc", "Notification Class") 104 | svc.rmempty = true 105 | local uci = luci.model.uci.cursor() 106 | uci:foreach("bacnet_nc", "nc", 107 | function (section) 108 | sva:value(section,section.name) 109 | end) 110 | sva = s:option(Value, "event", "BIT1 Alarm,BIT2 Fehler,BIT3 Alarm oder Fehler geht [7]") 111 | for i, v in ipairs(events) do 112 | sva:value(v[1],v[1]..": "..v[2]) 113 | end 114 | local sva = s:option(Value, "value_time", "value_time") 115 | 116 | return m 117 | 118 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_mo.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_mo") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_mo") then 25 | return 26 | end 27 | end 28 | 29 | local events = {} 30 | events[1] = {0,"Keine Ereignis Behandlung"} 31 | events[2] = {1,"Ereignis"} 32 | events[3] = {2,"Ereignis"} 33 | events[4] = {3,"Ereignis"} 34 | events[5] = {4,"Ereignis"} 35 | events[6] = {5,"Ereignis"} 36 | events[7] = {6,"Ereignis"} 37 | events[8] = {7,"Alle Ereignis behandeln"} 38 | 39 | --if arg1 then 40 | -- m = Map("bacnet_mo_"..arg1, "Bacnet Multistate Output", "Bacnet Multistate Output Configuration") 41 | --else 42 | m = Map("bacnet_mo", "Bacnet Multistate Output", "Bacnet Multistate Output Configuration") 43 | --end 44 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 45 | 46 | s = m:section(TypedSection, "mo", arg1 or 'Index') 47 | s.addremove = true 48 | s.anonymous = false 49 | s.template = "cbi/tblsection" 50 | 51 | s:option(Flag, "disable", "Disable") 52 | s:option(Flag, "Out_Of_Service", "Out Of Service") 53 | s:option(Value, "name", "Name") 54 | 55 | sva = s:option(Value, "tagname", "Zugrifsname") 56 | uci:foreach("linknx", "station", 57 | function (section) 58 | sva:value(section.tagname) 59 | end) 60 | uci:foreach("modbus", "station", 61 | function (section) 62 | sva:value(section.tagname) 63 | end) 64 | 65 | local sva = s:option(Value, "unit_id", "Unit ID") 66 | sva.placeholder = 1 67 | sva.datatype = "range(1, 255)" 68 | sva.rmempty = true 69 | local sva = s:option(ListValue, "func", "Funktions Code") 70 | sva:value('',"Halteregister (Holding Register) Default") 71 | sva:value('1',"Spulen (Coils)") 72 | sva:value('2',"Diskrete Eingäng (Disc Inputs)") 73 | sva:value('3',"Halteregister (Holding Register)") 74 | sva:value('4',"Eingaberegister (Input Register)") 75 | sva.rmempty = true 76 | local sva = s:option(Value, "addr", "Addr") 77 | sva.placeholder = 1 78 | sva.datatype = "string" 79 | local sva = s:option(ListValue, "dpt", "Datapoint Types defined in KNX standard") 80 | sva:value("","none") 81 | sva:value("1.001","1.001 switching (on/off) (EIS1)") 82 | sva:value("3.007","3.007 dimming (control of dimmer using up/down/stop) (EIS2)") 83 | sva:value("3.008","3.008 blinds (control of blinds using close/open/stop)") 84 | sva:value("5.xxx","5.xxx 8bit unsigned integer (from 0 to 255) (EIS6)") 85 | sva:value("7.xxx","7.xxx 16bit unsigned integer (EIS10)") 86 | sva:value("12.xxx","12.xxx 32bit unsigned integer (EIS11)") 87 | sva:value("20.102","20.102 heating mode (auto/comfort/standby/night/frost)") 88 | sva.rmempty = true 89 | 90 | s:option(Value, "value", "Value") 91 | s:option(Value, "fb_value", "Feedback Value") 92 | s:option(DynamicList, "state", "Stats") 93 | 94 | sva = s:option(Value, "group", "Gruppe") 95 | local uci = luci.model.uci.cursor() 96 | uci:foreach("bacnet_group", "group", 97 | function (section) 98 | sva:value(section.name) 99 | end) 100 | 101 | s:option(Value, "description", "Anzeige Name") 102 | s:option(Flag, "tl", "Trend Log") 103 | svc = s:option(Value, "nc", "Notification Class") 104 | svc.rmempty = true 105 | local uci = luci.model.uci.cursor() 106 | uci:foreach("bacnet_nc", "nc", 107 | function (section) 108 | sva:value(section,section.name) 109 | end) 110 | sva = s:option(Value, "event", "BIT1 Alarm,BIT2 Fehler,BIT3 Alarm oder Fehler geht [7]") 111 | for i, v in ipairs(events) do 112 | sva:value(v[1],v[1]..": "..v[2]) 113 | end 114 | local sva = s:option(Value, "value_time", "value_time") 115 | 116 | return m 117 | 118 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_mv.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_mv") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_mv") then 25 | return 26 | end 27 | end 28 | 29 | local events = {} 30 | events[1] = {0,"Keine Ereignis Behandlung"} 31 | events[2] = {1,"Ereignis"} 32 | events[3] = {2,"Ereignis"} 33 | events[4] = {3,"Ereignis"} 34 | events[5] = {4,"Ereignis"} 35 | events[6] = {5,"Ereignis"} 36 | events[7] = {6,"Ereignis"} 37 | events[8] = {7,"Alle Ereignis behandeln"} 38 | 39 | --if arg1 then 40 | -- m = Map("bacnet_mv_"..arg1, "Bacnet Multistate Value", "Bacnet Multistate Value Configuration") 41 | --else 42 | m = Map("bacnet_mv", "Bacnet Multistate Value", "Bacnet Multistate Value Configuration") 43 | --end 44 | m.on_after_commit = function() luci.sys.call("/bin/ubus call uci reload_config") end 45 | 46 | s = m:section(TypedSection, "mv", arg1 or 'Index') 47 | s.addremove = true 48 | s.anonymous = false 49 | s.template = "cbi/tblsection" 50 | 51 | s:option(Flag, "disable", "Disable") 52 | s:option(Flag, "Out_Of_Service", "Out Of Service") 53 | s:option(Value, "name", "Name") 54 | 55 | sva = s:option(Value, "tagname", "Zugrifsname") 56 | uci:foreach("linknx", "station", 57 | function (section) 58 | sva:value(section.tagname) 59 | end) 60 | uci:foreach("modbus", "station", 61 | function (section) 62 | sva:value(section.tagname) 63 | end) 64 | 65 | local sva = s:option(Value, "unit_id", "Unit ID") 66 | sva.placeholder = 1 67 | sva.datatype = "range(1, 255)" 68 | sva.rmempty = true 69 | local sva = s:option(ListValue, "func", "Funktions Code") 70 | sva:value('',"Halteregister (Holding Register) Default") 71 | sva:value('1',"Spulen (Coils)") 72 | sva:value('2',"Diskrete Eingäng (Disc Inputs)") 73 | sva:value('3',"Halteregister (Holding Register)") 74 | sva:value('4',"Eingaberegister (Input Register)") 75 | sva.rmempty = true 76 | local sva = s:option(Value, "addr", "Addr") 77 | sva.placeholder = 1 78 | sva.datatype = "string" 79 | local sva = s:option(ListValue, "dpt", "Datapoint Types defined in KNX standard") 80 | sva:value("","none") 81 | sva:value("1.001","1.001 switching (on/off) (EIS1)") 82 | sva:value("3.007","3.007 dimming (control of dimmer using up/down/stop) (EIS2)") 83 | sva:value("3.008","3.008 blinds (control of blinds using close/open/stop)") 84 | sva:value("5.xxx","5.xxx 8bit unsigned integer (from 0 to 255) (EIS6)") 85 | sva:value("7.xxx","7.xxx 16bit unsigned integer (EIS10)") 86 | sva:value("12.xxx","12.xxx 32bit unsigned integer (EIS11)") 87 | sva:value("20.102","20.102 heating mode (auto/comfort/standby/night/frost)") 88 | sva.rmempty = true 89 | 90 | s:option(Value, "value", "Value") 91 | s:option(DynamicList, "state", "Stats") 92 | s:option(DynamicList, "alarmstate", "Alarm Stats") 93 | 94 | sva = s:option(Value, "group", "Gruppe") 95 | local uci = luci.model.uci.cursor() 96 | uci:foreach("bacnet_group", "group", 97 | function (section) 98 | sva:value(section.name) 99 | end) 100 | 101 | s:option(Value, "description", "Anzeige Name") 102 | s:option(Flag, "tl", "Trend Log") 103 | svc = s:option(Value, "nc", "Notification Class") 104 | svc.rmempty = true 105 | local uci = luci.model.uci.cursor() 106 | uci:foreach("bacnet_nc", "nc", 107 | function (section) 108 | sva:value(section,section.name) 109 | end) 110 | sva = s:option(Value, "event", "BIT1 Alarm,BIT2 Fehler,BIT3 Alarm oder Fehler geht [7]") 111 | for i, v in ipairs(events) do 112 | sva:value(v[1],v[1]..": "..v[2]) 113 | end 114 | local sva = s:option(Value, "value_time", "value_time") 115 | 116 | return m 117 | 118 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_nc.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_nc") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_nc") then 25 | return 26 | end 27 | end 28 | 29 | --if arg1 then 30 | -- m = Map("bacnet_nc_"..arg1, "Bacnet Notification Class", "Bacnet Notification Class Configuration") 31 | --else 32 | m = Map("bacnet_nc", "Bacnet Notification Class", "Bacnet Notification Class Configuration") 33 | --end 34 | 35 | s = m:section(TypedSection, "nc", arg1 or 'NC Index') 36 | s.addremove = true 37 | s.anonymous = false 38 | s.template = "cbi/tblsection" 39 | 40 | s:option(Flag, "disable", "Disable") 41 | s:option(Value, "name", "NC Name") 42 | 43 | sva = s:option(ListValue, "group", "Gruppe") 44 | local uci = luci.model.uci.cursor() 45 | uci:foreach("bacnet_group", "group", 46 | function (section) 47 | sva:value(section.name) 48 | end) 49 | 50 | s:option(Value, "description", "Anzeige Name") 51 | sva = s:option(DynamicList, "recipient", "Empfaenger", "65535 fuer Broadcast oder net,ip:port z.B. 1,104.13.8.92:47808") 52 | 53 | return m 54 | 55 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/bacnet_tl.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | require("nixio.fs") 19 | local arg1 = arg[1] 20 | local uci = luci.model.uci.cursor() 21 | local uci_state = luci.model.uci.cursor_state() 22 | 23 | if not nixio.fs.access("/etc/config/bacnet_tl") then 24 | if not luci.sys.exec("touch /etc/config/bacnet_tl") then 25 | return 26 | end 27 | end 28 | 29 | --if arg1 then 30 | -- m = Map("bacnet_tl_"..arg1, "Bacnet Trendlog", "Bacnet Trendlog Configuration") 31 | --else 32 | m = Map("bacnet_tl", "Bacnet Trendlog", "Bacnet Trendlog Configuration") 33 | --end 34 | 35 | s = m:section(TypedSection, "tl", arg1 or 'TL Index') 36 | s.addremove = true 37 | s.anonymous = false 38 | s.template = "cbi/tblsection" 39 | 40 | s:option(Flag, "disable", "Disable") 41 | local sva = s:option(ListValue, "device_type", "Log Device Typ") 42 | sva:value("8","DEV") 43 | sva.rmempty = true 44 | 45 | local sva = s:option(ListValue, "object_type", "Log Objekt Typ") 46 | sva:value("0","AI") 47 | sva:value("1","AO") 48 | sva:value("2","AV") 49 | sva:value("3","BI") 50 | sva:value("4","BO") 51 | sva:value("5","BV") 52 | sva:value("13","MI") 53 | sva:value("14","MO") 54 | sva:value("19","MV") 55 | 56 | local sva = s:option(Value, "object_instance", "Log Objekt Index/Instance") 57 | sva.datatype = "range(0, 1024)" 58 | 59 | local sva = s:option(Value, "interval", "Interval in sekunden") 60 | sva.placeholder = 10 61 | sva.datatype = "range(1, 8640)" 62 | sva.rmempty = true 63 | 64 | return m 65 | -------------------------------------------------------------------------------- /luci-app-bacnet/luasrc/model/cbi/bacnet/groups.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.sys") 16 | require("luci.util") 17 | require("luci.tools.webadmin") 18 | m = Map("bacnet_group", "Gruppen", "Gruppen") 19 | 20 | 21 | s = m:section(TypedSection, "group", "Group") 22 | s.addremove = true 23 | s.anonymous = false 24 | s.extedit = luci.dispatcher.build_url("admin", "services", "bacnet_av") .. "/%s" 25 | s.template = "cbi/tblsection" 26 | s.sortable = true 27 | 28 | s:option(Flag, "disable", "Disable") 29 | s:option(Value, "name", "Gruppename/Raumname") 30 | s:option(Value, "groupexpr", "Gruppen/Raum Suchmuster") 31 | s:option(Value, "pgroup", "Mitglied der Gruppe") 32 | s:option(Value, "comment", "Anzeige Name") 33 | s:option(Value, "url", "Web Addresse") 34 | s:option(FileUpload, "img","/www/group.png") 35 | 36 | return m 37 | -------------------------------------------------------------------------------- /luci-app-chat/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=luci-app-chat 4 | PKG_VERSION:=0.8 5 | PKG_RELEASE:=0 6 | 7 | PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) 8 | 9 | include $(INCLUDE_DIR)/package.mk 10 | 11 | define Package/luci-app-chat 12 | SECTION:=luci 13 | CATEGORY:=LuCI 14 | SUBMENU:=3. Applications 15 | TITLE:=LocalChat 16 | DEPENDS:=+ws-mirror-server +luci-mod-admin-full 17 | endef 18 | 19 | define Package/luci-app-chat/description 20 | Local Chat via Web Sockets 21 | with libwsocket 22 | endef 23 | 24 | define Build/Prepare 25 | mkdir -p $(PKG_BUILD_DIR) 26 | $(CP) ./luasrc $(PKG_BUILD_DIR)/ 27 | endef 28 | 29 | define Build/Configure 30 | endef 31 | 32 | define Build/Compile 33 | $(MAKE) -C $(PKG_BUILD_DIR)/luasrc 34 | endef 35 | 36 | define Package/luci-app-chat/postinst 37 | #!/bin/sh 38 | [ -n "${IPKG_INSTROOT}" ] || { 39 | rm -f /tmp/luci-indexcache 40 | exit 0 41 | } 42 | endef 43 | 44 | define Package/luci-app-chat/install 45 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller 46 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view 47 | $(CP) $(PKG_BUILD_DIR)/luasrc/controller/* $(1)/usr/lib/lua/luci/controller 48 | $(CP) $(PKG_BUILD_DIR)/luasrc/view/* $(1)/usr/lib/lua/luci/view 49 | $(INSTALL_DIR) $(1)/www/luci-static/resources 50 | $(CP) ./luci-static/resources/* $(1)/www/luci-static/resources 51 | endef 52 | 53 | $(eval $(call BuildPackage,luci-app-chat)) 54 | -------------------------------------------------------------------------------- /luci-app-chat/luasrc/Makefile: -------------------------------------------------------------------------------- 1 | LUAC = luac 2 | LUAC_OPTIONS = -s 3 | 4 | world: compile 5 | 6 | compile: 7 | for i in $$(find -name *.lua -not -name debug.lua); do $(LUAC) $(LUAC_OPTIONS) -o $$i $$i; done 8 | 9 | -------------------------------------------------------------------------------- /luci-app-chat/luasrc/controller/chat.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.chat", package.seeall) 2 | 3 | local sys = require "luci.sys" 4 | local fs = require "nixio.fs" 5 | local uci = require "luci.model.uci".cursor() 6 | local http = require "luci.http" 7 | local util = require "luci.util" 8 | 9 | 10 | function index() 11 | 12 | local page = node() 13 | page.lock = true 14 | page.target = alias("chat") 15 | page.subindex = true 16 | page.index = false 17 | 18 | local page = node("chat") 19 | page.target = template("chat") 20 | page.title = "Chat" 21 | page.order = 100 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /luci-app-chat/luasrc/view/chat.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 | 3 |

Detected Browser:
...

4 | console:
5 | # ubus listen
6 | # ubus send chat '{ "id": "1234","nick": "icke","msg": "und er" }'
7 | 8 | 9 | 10 | 11 |
Not initialized
12 |

Nick Liste

13 |
    14 |
15 | 16 | 17 | 18 | 19 |
20 |

Chat Console

21 |
    22 |
23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | <%+footer%> 32 | 33 | -------------------------------------------------------------------------------- /luci-app-knxd/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=luci-app-knxd 4 | PKG_VERSION:=0.2.6 5 | PKG_RELEASE:=2 6 | PKG_BUILD_DEPENDS += LUCI_APP_KNXD_SRCDIET:luasrcdiet/host 7 | PKG_CONFIG_DEPENDS += CONFIG_LUCI_APP_KNXD_SRCDIET 8 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 9 | 10 | include $(INCLUDE_DIR)/package.mk 11 | 12 | define Package/luci-app-knxd 13 | SECTION:=luci 14 | CATEGORY:=LuCI 15 | SUBMENU:=3. Applications 16 | TITLE:=Eib KNX deamon 17 | URL:=https://github.com/knxd/knxd/wiki 18 | EXTRA_DEPENDS:=knxd, luci-mod-admin-full, luci-lib-nixio 19 | endef 20 | 21 | define Package/luci-app-knxd/config 22 | config LUCI_APP_KNXD_SRCDIET 23 | bool "knxd Minify Lua sources" 24 | default n 25 | endef 26 | 27 | define SrcDiet 28 | $(FIND) $(1) -type f -name '*.lua' | while read src; do \ 29 | if LUA_PATH="$(STAGING_DIR_HOSTPKG)/lib/lua/5.1/?.lua" luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; \ 30 | then mv "$$$$src.o" "$$$$src"; fi; \ 31 | done 32 | endef 33 | 34 | define Build/Prepare 35 | mkdir -p $(PKG_BUILD_DIR) 36 | $(CP) ./luasrc $(PKG_BUILD_DIR)/ 37 | endef 38 | 39 | define Build/Configure 40 | endef 41 | 42 | define Build/Compile 43 | $(if $(CONFIG_LUCI_APP_KNXD_SRCDIET),$(call SrcDiet,$(PKG_BUILD_DIR)/luasrc/),true); 44 | endef 45 | 46 | define Package/luci-app-knxd/postinst 47 | #!/bin/sh 48 | [ -n "${IPKG_INSTROOT}" ] || { 49 | rm -f /tmp/luci-indexcache 50 | exit 0 51 | } 52 | 53 | endef 54 | 55 | define Package/luci-app-knxd/install 56 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller 57 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi 58 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view 59 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/controller/knxd.lua $(1)/usr/lib/lua/luci/controller 60 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/model/cbi/knxd.lua $(1)/usr/lib/lua/luci/model/cbi 61 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/view/knxd_diag.htm $(1)/usr/lib/lua/luci/view 62 | $(INSTALL_DIR) $(1)/etc/uci-defaults 63 | $(INSTALL_BIN) files/etc/uci-defaults/luci-app-knxd $(1)/etc/uci-defaults/ 64 | $(INSTALL_DIR) $(1)/etc/init.d 65 | $(INSTALL_BIN) files/etc/init.d/knxd-ini $(1)/etc/init.d/ 66 | endef 67 | 68 | $(eval $(call BuildPackage,luci-app-knxd)) 69 | -------------------------------------------------------------------------------- /luci-app-knxd/files/etc/init.d/knxd-ini: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2016 OpenWrt.org 3 | 4 | START=98 5 | STOP=20 6 | PROG=/usr/bin/knxd 7 | USE_PROCD=1 8 | INI="/tmp/etc/knxd.ini" 9 | 10 | add_sec(){ 11 | local name=$(echo "$1" | tr "_" "-") 12 | echo "[$name]" >> $INI 13 | } 14 | 15 | add_str(){ 16 | local cfg=$1 17 | local name=$2 18 | local value=$3 19 | local rename=$(echo "$name" | tr "_" "-") 20 | [ -z "$value" ] && config_get value $cfg $name 21 | [ -z "$value" ] || echo "$rename = $value" >> $INI 22 | } 23 | 24 | add_bool(){ 25 | local cfg=$1 26 | local name=$2 27 | local rename=$(echo "$name" | tr "_" "-") 28 | config_get value $cfg $name 29 | [ "$value" = "0" ] && echo "$rename = false" >> $INI 30 | [ "$value" = "1" ] && echo "$rename = true" >> $INI 31 | } 32 | 33 | add_driver() { 34 | local cfg=$1 35 | config_get driver $cfg driver 36 | [ -z "$driver" ] && return 0 37 | add_sec "$cfg" 38 | #Drivers 39 | add_str $cfg driver 40 | #Common options 41 | add_bool $cfg ignore 42 | add_bool $cfg may_fail 43 | add_str $cfg retry_delay 44 | add_str $cfg max_retry 45 | add_str $cfg send_timeout 46 | add_str $cfg send_retries 47 | add_str $cfg debug 48 | #ip 49 | if [ "$driver" = "ip" ]; then 50 | add_str $cfg multicast_address 51 | add_str $cfg port 52 | config_get interface $cfg ip_interface 53 | [ -z "$interface" ] || network_get_device ifname "$interface" 54 | add_str $cfg interface $ifname 55 | fi 56 | if [ "$driver" = "ipt" \ 57 | -o "$driver" = "iptn" \ 58 | -o "$driver" = "tpuarttcp" \ 59 | -o "$driver" = "ncn5120tcp" \ 60 | -o "$driver" = "ft12tcp" \ 61 | -o "$driver" = "ft12cemitcp" ]; then 62 | add_str $cfg ip_address 63 | add_str $cfg dest_port 64 | fi 65 | if [ "$driver" = "ipt" \ 66 | -o "$driver" = "iptn" ]; then 67 | add_str $cfg src_port 68 | add_str $cfg heartbeat_timer 69 | add_str $cfg heartbeat_retries 70 | fi 71 | if [ "$driver" = "iptn" ]; then 72 | add_bool $cfg nat 73 | add_str $cfg nat_ip 74 | add_str $cfg data_port 75 | fi 76 | if [ "$driver" = "tpuart" \ 77 | -o "$driver" = "ncn5120" ]; then 78 | add_str $cfg device 79 | fi 80 | if [ "$driver" = "usb" ]; then 81 | config_get bus $cfg usb_bus 82 | add_str $cfg bus $bus 83 | config_get device $cfg usb_device 84 | add_str $cfg device $device 85 | config_get config $cfg usb_config 86 | add_str $cfg config $config 87 | config_get interface $cfg usb_interface 88 | add_str $cfg interface $interface 89 | config_get setting $cfg usb_setting 90 | add_str $cfg setting $setting 91 | config_get version $cfg usb_version 92 | add_str $cfg version $version 93 | fi 94 | if [ "$driver" = "tpuart" \ 95 | -o "$driver" = "ncn5120" \ 96 | -o "$driver" = "ft12" \ 97 | -o "$driver" = "ft12cemi" ]; then 98 | config_get device $cfg tty_device 99 | add_str $cfg device $device 100 | add_str $cfg baudrate 101 | fi 102 | #More common options 103 | add_bool $cfg ack_group 104 | add_bool $cfg ack_individual 105 | add_bool $cfg reset 106 | add_bool $cfg monitor 107 | } 108 | 109 | add_server() { 110 | local cfg=$1 111 | config_get server $cfg server 112 | [ -z "$server" ] && return 0 113 | add_sec "$cfg" 114 | #Server 115 | add_str $cfg server 116 | #Common options 117 | add_bool $cfg ignore 118 | add_bool $cfg may_fail 119 | add_str $cfg retry_delay 120 | add_str $cfg max_retry 121 | add_str $cfg send_timeout 122 | add_str $cfg debug 123 | if [ "$server" = "knxd_tcp" \ 124 | -o "$server" = "ets_router" ]; then 125 | add_str $cfg port 126 | config_get interface $cfg interface 127 | [ -z "$interface" ] || network_get_device ifname "$interface" 128 | add_str $cfg interface $ifname 129 | fi 130 | if [ "$server" = "knxd_tcp" ]; then 131 | add_str $cfg ip_address 132 | fi 133 | if [ "$server" = "ets_router" ]; then 134 | add_str $cfg multicast_address 135 | add_str $cfg tunnel 136 | add_str $cfg router 137 | add_bool $cfg discover 138 | add_bool $cfg multi_port 139 | add_str $cfg name 140 | fi 141 | if [ "$server" = "knxd_unix" ]; then 142 | add_str $cfg path 143 | fi 144 | } 145 | 146 | add_dbg() { 147 | local cfg=$1 148 | add_sec "$cfg" 149 | add_str $cfg name 150 | add_str $cfg error_level 151 | add_str $cfg trace_mask 152 | add_bool $cfg timestamps 153 | } 154 | 155 | add_main() { 156 | local cfg=$1 157 | add_sec "main" 158 | add_bool $cfg background 159 | add_str $cfg addr 160 | add_str $cfg client_addrs 161 | add_str $cfg connections 162 | add_str $cfg logfile 163 | add_str $cfg name 164 | add_str $cfg cache 165 | add_str $cfg force_broadcast 166 | add_str $cfg debug 167 | } 168 | 169 | start_service() { 170 | . /lib/functions/network.sh 171 | >$INI 172 | config_load knxd 173 | config_get cfg_source args cfg_source 174 | if [ "$cfg_source" = "file" ]; then 175 | config_get INI args cfg_path 176 | else 177 | config_foreach add_driver driver 178 | config_foreach add_server server 179 | config_foreach add_dbg debug 180 | config_foreach add_main main 181 | fi 182 | procd_open_instance 183 | procd_set_param command $PROG $INI 184 | procd_set_param respawn 185 | procd_close_instance 186 | } 187 | stop_service() { 188 | killall knxd 189 | } 190 | 191 | reload_service() 192 | { 193 | restart 194 | } 195 | 196 | service_triggers() 197 | { 198 | procd_add_reload_trigger knxd 199 | } 200 | -------------------------------------------------------------------------------- /luci-app-knxd/files/etc/uci-defaults/luci-app-knxd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$(uci get ucitrack.@knxd[0].init 2>/dev/null)" != "knxd-ini" ] && \ 4 | uci batch <<-EOF >/dev/null 2>/dev/null 5 | get ucitrack.@knxd[0] || add ucitrack knxd 6 | set ucitrack.@knxd[0].init='knxd-ini' 7 | commit ucitrack 8 | EOF 9 | 10 | . /lib/functions.sh 11 | 12 | add_cfg=1 13 | chk_cfg() { 14 | add_cfg=0 15 | } 16 | config_load knxd 17 | config_foreach chk_cfg driver 18 | config_foreach chk_cfg server 19 | config_foreach chk_cfg debug 20 | config_foreach chk_cfg main 21 | 22 | if [ $add_cfg -eq 1 ] ; then 23 | uci_add knxd server A 24 | uci_set knxd A port '6720' 25 | uci_set knxd A server 'knxd_tcp' 26 | uci_set knxd A systemd_ignore 'false' 27 | uci_commit knxd 28 | uci_add knxd server server 29 | uci_set knxd server debug 'debug-server' 30 | uci_set knxd server systemd_ignore 'false' 31 | uci_set knxd server server 'ets_router' 32 | uci_set knxd server discover '1' 33 | uci_set knxd server interface 'lan' 34 | uci_set knxd server multicast_address '224.0.23.12' 35 | uci_set knxd server tunnel 'tunnel' 36 | uci_commit knxd 37 | uci_add knxd server B 38 | uci_set knxd B socktype 'unix' 39 | uci_set knxd B path '/var/run/knxd' 40 | uci_set knxd B server 'knxd_unix' 41 | uci_set knxd B systemd_ignore '0' 42 | uci_commit knxd 43 | uci_add knxd driver C 44 | uci_set knxd C socktype 'ip' 45 | uci_set knxd C driver 'usb' 46 | uci_set knxd C usb_bus '2' 47 | uci_set knxd C usb_device '2' 48 | uci_set knxd C usb_config '1' 49 | uci_commit knxd 50 | uci_add knxd debug debug_server 51 | uci_set knxd debug_server name 'mcast:knxd' 52 | uci_commit knxd 53 | uci_add knxd main router 54 | uci_set knxd router addr '0.0.100' 55 | uci_set knxd router client_addrs '2.2.20:10' 56 | uci_set knxd router connections 'A,server,B,C' 57 | uci_set knxd router logfile '/var/log/knxd.log' 58 | uci_set knxd router name "$(uname -n)" 59 | uci_commit knxd 60 | fi 61 | 62 | /etc/init.d/knxd stop 2>/dev/null 63 | /etc/init.d/knxd disable 2>/dev/null 64 | /etc/init.d/knxd-ini enable 65 | 66 | exit 0 67 | -------------------------------------------------------------------------------- /luci-app-knxd/luasrc/controller/knxd.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | module("luci.controller.knxd", package.seeall) 16 | 17 | local uci = require("luci.model.uci").cursor() 18 | 19 | function index() 20 | local uci = require("luci.model.uci").cursor() 21 | local fs = require("nixio.fs") 22 | 23 | if not fs.access("/etc/config/knxd") then 24 | return 25 | end 26 | 27 | local page 28 | page = entry({"admin", "services", "knxd"}, cbi("knxd")) 29 | page.dependent = true 30 | page.title = _("knxd") 31 | page.order = 10 32 | 33 | page = node("admin", "services", "knxd_diag") 34 | page.target = template("knxd_diag") 35 | page.title = _("knxd Diagnostics") 36 | page.order = 11 37 | 38 | page = entry({"admin", "services", "knxd_diag_vbusmonitor"}, call("knxd_diag_vbusmonitor"), nil) 39 | page.leaf = true 40 | 41 | page = entry({"admin", "services", "knxd_diag_groupsocketlisten"}, call("knxd_diag_groupsocketlisten"), nil) 42 | page.leaf = true 43 | 44 | page = entry({"admin", "services", "knxd_diag_groupswrite"}, call("knxd_diag_groupswrite"), nil) 45 | page.leaf = true 46 | 47 | page = entry({"admin", "services", "knxd_diag_proto"}, call("knxd_diag_proto"), nil) 48 | page.leaf = true 49 | 50 | page = entry({"admin", "services", "knxd_diag_ini"}, call("knxd_diag_ini"), nil) 51 | page.leaf = true 52 | end 53 | 54 | function knxd_diag_vbusmonitor() 55 | local listen_tcp = uci:get( "knxd", "args", "listen_tcp" ) 56 | local listen_local = uci:get( "knxd", "args", "listen_local" ) 57 | if listen_tcp then 58 | local cmd = "knxtool vbusmonitor1 ip:127.0.0.1:"..listen_tcp.." 2>&1" 59 | elseif listen_local then 60 | local cmd = "knxtool vbusmonitor1 local:"..listen_local.." 2>&1" 61 | else 62 | return 63 | end 64 | 65 | luci.http.prepare_content("text/plain") 66 | luci.http.write(cmd) 67 | local util = io.popen(cmd) 68 | if util then 69 | while true do 70 | local ln = util:read("*l") 71 | if not ln then break end 72 | luci.http.write(ln) 73 | luci.http.write("\n") 74 | end 75 | util:close() 76 | end 77 | return 78 | end 79 | 80 | function knxd_diag_groupsocketlisten() 81 | local listen_tcp = uci:get( "knxd", "args", "listen_tcp" ) 82 | local listen_local = uci:get( "knxd", "args", "listen_local" ) 83 | if listen_tcp then 84 | local cmd = "knxtool groupsocketlisten ip:127.0.0.1:"..listen_tcp.." 2>&1" 85 | elseif listen_local then 86 | local cmd = "knxtool groupsocketlisten local:"..listen_local.." 2>&1" 87 | else 88 | return 89 | end 90 | 91 | luci.http.prepare_content("text/plain") 92 | luci.http.write(cmd) 93 | local util = io.popen(cmd) 94 | if util then 95 | while true do 96 | local ln = util:read("*l") 97 | if not ln then break end 98 | luci.http.write(ln) 99 | luci.http.write("\n") 100 | end 101 | util:close() 102 | end 103 | return 104 | end 105 | 106 | function knxd_diag_groupswrite() 107 | local addr = luci.http.formvalue("addr") 108 | local value = luci.http.formvalue("value") 109 | if not value or not addr then 110 | --TODO err mesg 111 | return 112 | end 113 | local listen_tcp = uci:get( "knxd", "args", "listen_tcp" ) 114 | local listen_local = uci:get( "knxd", "args", "listen_local" ) 115 | local cmd 116 | if listen_tcp then 117 | cmd = "knxtool groupswrite ip:127.0.0.1:"..listen_tcp.." "..addr.." "..value 118 | elseif listen_local then 119 | cmd = "knxtool groupswrite local:"..listen_local.." "..addr.." "..value 120 | else 121 | cmd = "knx is not listen on 127.0.0.1 or local socket" 122 | end 123 | luci.http.prepare_content("text/plain") 124 | luci.http.write(cmd) 125 | luci.http.write("\n") 126 | luci.http.write(" ret: ") 127 | luci.http.write("\n") 128 | local util = io.popen(cmd) 129 | if util then 130 | while true do 131 | local ln = util:read("*l") 132 | if not ln then break end 133 | luci.http.write(ln) 134 | luci.http.write("\n") 135 | end 136 | util:close() 137 | end 138 | return 139 | end 140 | 141 | function knxd_diag_proto() 142 | local cmd = "cat /var/log/knxd.log" 143 | luci.http.prepare_content("text/plain") 144 | luci.http.write(cmd) 145 | luci.http.write("\n") 146 | local util = io.popen(cmd) 147 | if util then 148 | while true do 149 | local ln = util:read("*l") 150 | if not ln then break end 151 | luci.http.write(ln) 152 | luci.http.write("\n") 153 | end 154 | util:close() 155 | end 156 | return 157 | end 158 | 159 | function knxd_diag_ini() 160 | local cmd = "cat /tmp/etc/knxd.ini" 161 | luci.http.prepare_content("text/plain") 162 | luci.http.write(cmd) 163 | luci.http.write("\n") 164 | local util = io.popen(cmd) 165 | if util then 166 | while true do 167 | local ln = util:read("*l") 168 | if not ln then break end 169 | luci.http.write(ln) 170 | luci.http.write("\n") 171 | end 172 | util:close() 173 | end 174 | return 175 | end 176 | -------------------------------------------------------------------------------- /luci-app-knxd/luasrc/view/knxd_diag.htm: -------------------------------------------------------------------------------- 1 | <%# 2 | Copyright 2015 Patrick Grimm 3 | Licensed to the public under the Apache License 2.0. 4 | -%> 5 | 6 | <%+header%> 7 | 8 | 9 | 79 | 80 |
"> 81 |
82 |

<%:KNX Diagnostics%>

83 | 84 |
85 | <%:KNX Tools%> 86 | 87 |
88 | 89 |
90 | 91 |
92 | 93 |
94 | 95 |
96 | 97 |
98 |
99 | Adresse 100 | Wert 101 |
102 | 103 |
104 | 105 |
106 | 107 |
108 | 109 |
110 | 111 |

112 | 113 |
114 |
115 | 116 | 120 |
121 | 122 | <%+footer%> 123 | -------------------------------------------------------------------------------- /luci-app-linknx/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=luci-app-linknx 4 | PKG_VERSION:=0.3.3 5 | PKG_RELEASE:=1 6 | PKG_BUILD_DEPENDS += LUCI_APP_LINKNX_SRCDIET:luasrcdiet/host 7 | PKG_CONFIG_DEPENDS += CONFIG_LUCI_APP_LINKNX_SRCDIET 8 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 9 | 10 | include $(INCLUDE_DIR)/package.mk 11 | 12 | define Package/luci-app-linknx 13 | SECTION:=luci 14 | CATEGORY:=LuCI 15 | SUBMENU:=3. Applications 16 | TITLE:=linknx daemon 17 | URL:=https://github.com/linknx/linknx/wiki 18 | EXTRA_DEPENDS:=linknx-uci, luci-mod-admin-full, collectd-mod-exec, luci-app-statistics 19 | endef 20 | 21 | define Package/luci-app-linknx/config 22 | config LUCI_APP_LINKNX_SRCDIET 23 | bool "linknx Minify Lua sources" 24 | default n 25 | endef 26 | 27 | define SrcDiet 28 | $(FIND) $(1) -type f -name '*.lua' | while read src; do \ 29 | if LUA_PATH="$(STAGING_DIR_HOSTPKG)/lib/lua/5.1/?.lua" luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; \ 30 | then mv "$$$$src.o" "$$$$src"; fi; \ 31 | done 32 | endef 33 | 34 | define Build/Prepare 35 | mkdir -p $(PKG_BUILD_DIR) 36 | $(CP) ./luasrc $(PKG_BUILD_DIR)/ 37 | endef 38 | 39 | define Build/Configure 40 | endef 41 | 42 | define Build/Compile 43 | $(if $(CONFIG_LUCI_APP_LINKNX_SRCDIET),$(call SrcDiet,$(PKG_BUILD_DIR)/luasrc/),true); 44 | endef 45 | 46 | define Package/luci-app-linknx/postinst 47 | #!/bin/sh 48 | [ -n "${IPKG_INSTROOT}" ] || { 49 | rm -f /tmp/luci-indexcache 50 | exit 0 51 | } 52 | 53 | endef 54 | 55 | define Package/luci-app-linknx/install 56 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller 57 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi 58 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view 59 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/controller/linknx.lua $(1)/usr/lib/lua/luci/controller 60 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/model/cbi/linknx.lua $(1)/usr/lib/lua/luci/model/cbi 61 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/model/cbi/linknx_xml.lua $(1)/usr/lib/lua/luci/model/cbi 62 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/luasrc/view/linknx_diag.htm $(1)/usr/lib/lua/luci/view 63 | $(INSTALL_DIR) $(1)/etc/uci-defaults 64 | $(INSTALL_BIN) ./files/etc/uci-defaults/linknx-uci $(1)/etc/uci-defaults 65 | $(INSTALL_DIR) $(1)/etc/collectd/conf.d 66 | $(INSTALL_DATA) ./files/etc/collectd/conf.d/linknx.conf $(1)/etc/collectd/conf.d 67 | $(INSTALL_DIR) $(1)/usr/bin 68 | $(INSTALL_BIN) ./files/usr/bin/linknx-stat.sh $(1)/usr/bin 69 | $(INSTALL_DIR) $(1)/usr/share/collectd 70 | $(INSTALL_DATA) ./files/usr/share/collectd/linknx.db $(1)/usr/share/collectd 71 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/statistics/rrdtool/definitions 72 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/luasrc/statistics/rrdtool/definitions/linknx.lua $(1)/usr/lib/lua/luci/statistics/rrdtool/definitions 73 | endef 74 | 75 | $(eval $(call BuildPackage,luci-app-linknx)) 76 | -------------------------------------------------------------------------------- /luci-app-linknx/files/etc/collectd/conf.d/linknx.conf: -------------------------------------------------------------------------------- 1 | TypesDB "/usr/share/collectd/linknx.db" 2 | -------------------------------------------------------------------------------- /luci-app-linknx/files/etc/uci-defaults/linknx-uci: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | grep -q "/usr/bin/linknx-stat.sh" /etc/config/luci_statistics || 4 | uci -q batch <<-EOF >/dev/null 5 | set luci_statistics.collectd_exec.enable=1 6 | delete luci_statistics.@collectd_exec_input[-1] 7 | add luci_statistics collectd_exec_input 8 | set luci_statistics.@collectd_exec_input[-1].cmdline='/usr/bin/linknx-stat.sh' 9 | commit luci_statistics 10 | EOF 11 | 12 | chmod 644 /etc/config/knx_* 13 | 14 | exit 0 15 | -------------------------------------------------------------------------------- /luci-app-linknx/files/usr/bin/linknx-stat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | 5 | HOST="$COLLECTD_HOSTNAME" 6 | INTERVAL=$(echo ${COLLECTD_INTERVAL:-8} | cut -d . -f 1) 7 | sleep_n=$((INTERVAL-5)) 8 | 9 | var_5xxx="" 10 | var_5001="" 11 | var_5003="" 12 | var_6xxx="" 13 | var_7xxx="" 14 | var_8xxx="" 15 | var_9xxx="" 16 | var_xxxx="" 17 | 18 | add_var() { 19 | local cfg=$1 20 | local config=$2 21 | config_get type $cfg type 22 | case $type in 23 | 5.xxx) var_5xxx=$var_5xxx" $config.$cfg";; 24 | 5.001) var_5001=$var_5001" $config.$cfg";; 25 | 5.003) var_5003=$var_5003" $config.$cfg";; 26 | 6.xxx) var_6xxx=$var_6xxx" $config.$cfg";; 27 | 7.xxx) var_7xxx=$var_7xxx" $config.$cfg";; 28 | 8.xxx) var_8xxx=$var_8xxx" $config.$cfg";; 29 | 9.xxx) var_9xxx=$var_9xxx" $config.$cfg";; 30 | *) var_xxxx=$var_xxxx" $config.$cfg";; 31 | esac 32 | } 33 | 34 | for i in $(seq 0 31); do 35 | for j in $(seq 0 7); do 36 | [ -f /etc/config/knx_"$i"_"$j" ] || continue 37 | config_load knx_"$i"_"$j" 38 | config_foreach add_var grp knx_"$i"_"$j" 39 | done 40 | done 41 | 42 | while sleep $sleep_n; do 43 | for i in $var_5xxx ; do 44 | value=$(uci -q -p /var/state get $i.value) 45 | [ -z $value ] && continue 46 | echo "PUTVAL $HOST/linknx-$i/5xxx interval=$INTERVAL N:$value" 47 | count=$(uci -q -p /var/state get $i.count) 48 | [ -z $count ] && continue 49 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 50 | done 51 | for i in $var_5001 ; do 52 | value=$(uci -q -p /var/state get $i.value) 53 | [ -z $value ] && continue 54 | echo "PUTVAL $HOST/linknx-$i/5001 interval=$INTERVAL N:$value" 55 | count=$(uci -q -p /var/state get $i.count) 56 | [ -z $count ] && continue 57 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 58 | done 59 | for i in $var_5003 ; do 60 | value=$(uci -q -p /var/state get $i.value) 61 | [ -z $value ] && continue 62 | echo "PUTVAL $HOST/linknx-$i/5003 interval=$INTERVAL N:$value" 63 | count=$(uci -q -p /var/state get $i.count) 64 | [ -z $count ] && continue 65 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 66 | done 67 | for i in $var_6xxx ; do 68 | value=$(uci -q -p /var/state get $i.value) 69 | [ -z $value ] && continue 70 | echo "PUTVAL $HOST/linknx-$i/6xxx interval=$INTERVAL N:$value" 71 | count=$(uci -q -p /var/state get $i.count) 72 | [ -z $count ] && continue 73 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 74 | done 75 | for i in $var_7xxx ; do 76 | value=$(uci -q -p /var/state get $i.value) 77 | [ -z $value ] && continue 78 | echo "PUTVAL $HOST/linknx-$i/7xxx interval=$INTERVAL N:$value" 79 | count=$(uci -q -p /var/state get $i.count) 80 | [ -z $count ] && continue 81 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 82 | done 83 | for i in $var_8xxx ; do 84 | value=$(uci -q -p /var/state get $i.value) 85 | [ -z $value ] && continue 86 | echo "PUTVAL $HOST/linknx-$i/8xxx interval=$INTERVAL N:$value" 87 | count=$(uci -q -p /var/state get $i.count) 88 | [ -z $count ] && continue 89 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 90 | done 91 | for i in $var_9xxx ; do 92 | value=$(uci -q -p /var/state get $i.value) 93 | [ -z $value ] && continue 94 | echo "PUTVAL $HOST/linknx-$i/9xxx interval=$INTERVAL N:$value" 95 | count=$(uci -q -p /var/state get $i.count) 96 | [ -z $count ] && continue 97 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 98 | done 99 | for i in $var_xxxx ; do 100 | count=$(uci -q -p /var/state get $i.count) 101 | [ -z $count ] && continue 102 | echo "PUTVAL $HOST/linknx-$i/derive interval=$INTERVAL N:$count" 103 | done 104 | done 105 | -------------------------------------------------------------------------------- /luci-app-linknx/files/usr/share/collectd/linknx.db: -------------------------------------------------------------------------------- 1 | 5xxx value:GAUGE:0:255 2 | 5001 value:GAUGE:0:100 3 | 5003 value:GAUGE:0:360 4 | 6xxx value:GAUGE:-128:128 5 | 7xxx value:GAUGE:0:65536 6 | 8xxx value:GAUGE:-65536:65536 7 | 9xxx value:GAUGE:0:U 8 | -------------------------------------------------------------------------------- /luci-app-linknx/luasrc/controller/linknx.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | module("luci.controller.linknx", package.seeall) 16 | 17 | function index() 18 | 19 | local page = entry({"admin", "services", "linknx"}, cbi("linknx")) 20 | page.dependent = true 21 | page.title = _("linknx") 22 | page.order = 12 23 | page.leaf = true 24 | page.subindex = true 25 | 26 | local page = entry({"admin", "services", "linknx_xml"}, form("linknx_xml")) 27 | page.dependent = true 28 | page.title = _("linknx xml import") 29 | page.order = 13 30 | 31 | local page = node("admin", "services", "linknx_diag") 32 | page.target = template("linknx_diag") 33 | page.title = _("linknx Diagnostics") 34 | page.order = 14 35 | 36 | local page = entry({"admin", "services", "linknx_diag_read"}, call("linknx_diag_read"), nil) 37 | page.leaf = true 38 | 39 | local page = entry({"admin", "services", "linknx_diag_write"}, call("linknx_diag_write"), nil) 40 | page.leaf = true 41 | 42 | local page = entry({"admin", "services", "linknx_diag_proto"}, call("linknx_diag_proto"), nil) 43 | page.leaf = true 44 | 45 | end 46 | 47 | function linknx_diag_read() 48 | local addr = luci.http.formvalue("addr") 49 | if not addr then 50 | luci.http.prepare_content("text/plain") 51 | luci.http.write("Keine Adresse") 52 | luci.http.write("\n") 53 | return 54 | end 55 | if not nixio.fs.access("/var/run/linknx") then 56 | luci.http.prepare_content("text/plain") 57 | luci.http.write("linknx is not listen on unix:/var/run/linknx") 58 | luci.http.write("\n") 59 | return 60 | end 61 | local nixio = require "nixio" 62 | local s = nixio.socket('unix', 'stream', none) 63 | s:connect('/var/run/linknx') 64 | s:send("\r\n\4") 65 | local ret = s:recv(8192) or '' 66 | luci.http.prepare_content("text/plain") 67 | luci.http.write(addr) 68 | luci.http.write(" ret: ") 69 | luci.http.write(ret) 70 | luci.http.write("\n") 71 | return 72 | end 73 | 74 | function linknx_diag_write() 75 | local addr = luci.http.formvalue("addr") 76 | local value = luci.http.formvalue("value") 77 | if not addr then 78 | luci.http.prepare_content("text/plain") 79 | luci.http.write("Keine Adresse") 80 | luci.http.write("\n") 81 | return 82 | end 83 | if not value then 84 | luci.http.prepare_content("text/plain") 85 | luci.http.write("Keine Wert") 86 | luci.http.write("\n") 87 | return 88 | end 89 | if not nixio.fs.access("/var/run/linknx") then 90 | luci.http.prepare_content("text/plain") 91 | luci.http.write("linknx is not listen on unix:/var/run/linknx") 92 | luci.http.write("\n") 93 | return 94 | end 95 | local nixio = require "nixio" 96 | local s = nixio.socket('unix', 'stream', none) 97 | s:connect('/var/run/linknx') 98 | s:send("\r\n\4") 99 | local ret = s:recv(8192) or '' 100 | luci.http.prepare_content("text/plain") 101 | luci.http.write(addr) 102 | luci.http.write(" ret: ") 103 | luci.http.write(ret) 104 | luci.http.write("\n") 105 | return 106 | end 107 | 108 | function linknx_diag_proto() 109 | local cmd = "cat /var/log/linknx.log" 110 | luci.http.prepare_content("text/plain") 111 | luci.http.write(cmd) 112 | local util = io.popen(cmd) 113 | if util then 114 | while true do 115 | local ln = util:read("*l") 116 | if not ln then break end 117 | luci.http.write(ln) 118 | luci.http.write("\n") 119 | end 120 | util:close() 121 | end 122 | return 123 | end 124 | -------------------------------------------------------------------------------- /luci-app-linknx/luasrc/model/cbi/linknx.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | require("luci.tools.webadmin") 16 | local uci = luci.model.uci.cursor() 17 | local arg1 = arg[1] 18 | 19 | function load_group(group,sec) 20 | maingrp = uci:get(group,"main_group", "Name") 21 | middlegrp = uci:get(group,"middle_group", "Name") 22 | dval = sec:option(DummyValue, group) 23 | dval.href = luci.dispatcher.build_url("admin", "services", "linknx") .. "/"..group 24 | dval.rawhtml = true 25 | dval.default = group.." "..maingrp.."/"..middlegrp 26 | end 27 | 28 | if not arg1 then 29 | m = Map("linknx", "linknx Server", "high level functionalities to EIB/KNX installation") 30 | s = m:section(SimpleSection, "grp", "KNX groups") 31 | for i=0,31 do 32 | for j=0,7 do 33 | local groupname="knx_"..i.."_"..j 34 | local f = io.open("/etc/config/"..groupname,"r") 35 | if f~=nil then 36 | io.close(f) 37 | load_group(groupname,s) 38 | end 39 | end 40 | end 41 | s = m:section(NamedSection, "args", "LINKNX deamon") 42 | --o = s:option(Value, "conf", "xml config file") 43 | o = s:option(FileUpload, "conf", "xml config file") 44 | o.placeholder="/etc/linknx.xml" 45 | o.default="/etc/linknx.xml" 46 | o.optional = false 47 | o = s:option(Value, "options", "options") 48 | o.placeholder="-w --daemon=/tmp/linknx/linknx.log --pid-file=/var/run/linknx.pid" 49 | o.default="-w --daemon=/tmp/linknx/linknx.log --pid-file=/var/run/linknx.pid" 50 | o.optional = false 51 | 52 | mq = Map("linknx_mqtt", "linknx MQTT Server", "settings") 53 | mqs = mq:section(NamedSection, "mqtt", "connection") 54 | mqs:option(Value, "host", "hostname").datatype = "hostname" 55 | mqs:option(Value, "port", "port").datatype = "port" 56 | mqs:option(Value, "user", "user").datatype = "string" 57 | mqs:option(Value, "pw", "pw").password = true 58 | return mq,n 59 | else 60 | maingrp = uci:get(arg1,"main_group", "Name") 61 | middlegrp = uci:get(arg1,"middle_group", "Name") 62 | m = Map(arg1, arg1, arg1.." "..maingrp.."/"..middlegrp) 63 | s = m:section(TypedSection, "grp", "KNX groups") 64 | s.template = "cbi/tblsection" 65 | local dval = s:option(DummyValue, "Value","Value") 66 | function dval.value(self, section) 67 | value = self.map:get(section) 68 | return uci:get_state(arg1,value[".name"],"value") or "" 69 | end 70 | function dval.cfgvalue(self, section) 71 | value = self.map:get(section) 72 | return uci:get_state(arg1,value[".name"],"value") or "" 73 | end 74 | local nval = s:option(Value, "newValue","newValue") 75 | function nval.cfgvalue(self, section) 76 | local sec = self.map:get(section) 77 | return uci:get_state(arg1,sec[".name"],"value") or "" 78 | end 79 | function nval.write(self, section, value) 80 | local sec = self.map:get(section) 81 | local cvalue = self:cfgvalue(section) or "" 82 | local varname=arg1.."."..sec[".name"] 83 | --io.popen("logger -p info -t luciwrite "..varname.." fvalue ".." "..value.." cvalue "..cvalue.." >/dev/null 2>&1 &") 84 | if value and cvalue~=value then 85 | --BUG ON knx is faster then this luci cgi. form value is unchanged and uci state has new feedback from knx 86 | io.popen("(sleep 2 && /usr/bin/linknxwritevalue.lua "..varname.." "..value.." )>/dev/null 2>&1 &") 87 | --io.popen("logger -p info -t luciwrite write >/dev/null 2>&1 &") 88 | end 89 | end 90 | s:option(Value, "Address", "Address") 91 | s:option(Value, "Name", "ETS Name") 92 | s:option(Value, "type", "type") 93 | s:option(Flag, "homebridge", "Homebridge") 94 | local svc = s:option(ListValue, "characteristic", "Characteristic") 95 | svc:value('') 96 | svc:value('CurrentTemperature') 97 | svc:value('Brightness') 98 | return m 99 | end -------------------------------------------------------------------------------- /luci-app-linknx/luasrc/model/cbi/linknx_xml.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2008 Steven Barth 2 | -- Copyright 2008-2013 Jo-Philipp Wich 3 | -- Licensed to the public under the Apache License 2.0. 4 | 5 | local fs = require "nixio.fs" 6 | local conffile = "/etc/luci-uploads/ets5export.xml" 7 | 8 | f = SimpleForm("linknx_xml", "linknx import ets5export.xml file", nil) 9 | t = f:field(TextValue, "import_xml") 10 | t.rmempty = true 11 | t.rows = 20 12 | function t.cfgvalue() 13 | return fs.readfile(conffile) or "" 14 | end 15 | 16 | function f.handle(self, state, data) 17 | if state == FORM_VALID then 18 | if data.import_xml then 19 | fs.writefile(conffile, data.import_xml:gsub("\r\n", "\n")) 20 | io.popen("/usr/bin/ets5xml2uci.lua "..conffile) 21 | io.popen("/etc/init.d/linknx-uci restart") 22 | end 23 | end 24 | return true 25 | end 26 | 27 | return f 28 | -------------------------------------------------------------------------------- /luci-app-linknx/luasrc/statistics/rrdtool/definitions/linknx.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2011 Jo-Philipp Wich 2 | -- Licensed to the public under the Apache License 2.0. 3 | 4 | 5 | module("luci.statistics.rrdtool.definitions.linknx", package.seeall) 6 | 7 | function item() 8 | return luci.i18n.translate("LINKNX") 9 | end 10 | 11 | function rrdargs( graph, plugin, plugin_instance, dtype ) 12 | local uci = luci.model.uci.cursor() 13 | local config = string.gsub(plugin_instance,"^(.-)%..*$","%1") 14 | local section = string.gsub(plugin_instance,"^.*%.(.-)$","%1") 15 | local maingrp = uci:get(config, "main_group", "Name") or "Main" 16 | local middlegrp = uci:get(config, "middle_group", "Name") or "Middle" 17 | local subgrp = uci:get(config, section, "Name") or "Sub" 18 | local comment = config.."."..section.." "..maingrp.."/"..middlegrp.."/"..subgrp 19 | local dt5xxx = { 20 | title = "%H: 5.xxx "..comment, 21 | vlabel = "", 22 | number_format = "%3.1lf", 23 | data = { 24 | types = { "5xxx" }, 25 | options = { 26 | dt5xx = { 27 | title= "5.xxx", 28 | overlay = true, 29 | color = "0000ff" 30 | } 31 | } 32 | } 33 | } 34 | local dt5001 = { 35 | title = "%H: 5.001 Percent "..comment, 36 | vlabel = "%", 37 | number_format = "%3.1lf", 38 | data = { 39 | types = { "5001" }, 40 | options = { 41 | dt5001 = { 42 | title= "5.001", 43 | overlay = true, 44 | color = "ff0000" 45 | } 46 | } 47 | } 48 | } 49 | local dt5003 = { 50 | title = "%H: 5.003 Angle "..comment, 51 | vlabel = "degree", 52 | number_format = "%3.1lf degree", 53 | data = { 54 | types = { "5003" }, 55 | options = { 56 | dt5003 = { 57 | title= "Angle", 58 | overlay = true, 59 | color = "0000ff" 60 | } 61 | } 62 | } 63 | } 64 | local dt6xxx = { 65 | title = "%H: 6.xxx "..comment, 66 | vlabel = "", 67 | number_format = "%3.1lf", 68 | data = { 69 | types = { "6xxx" }, 70 | options = { 71 | dt6xxx = { 72 | title= "6.xxx", 73 | overlay = true, 74 | color = "0000ff" 75 | } 76 | } 77 | } 78 | } 79 | local dt7xxx = { 80 | title = "%H: 7.xxx "..comment, 81 | vlabel = "", 82 | number_format = "%3.1lf", 83 | data = { 84 | types = { "7xxx" }, 85 | options = { 86 | dt7xxx = { 87 | title= "7.xxx", 88 | overlay = true, 89 | color = "0000ff" 90 | } 91 | } 92 | } 93 | } 94 | local dt8xxx = { 95 | title = "%H: 8.xxx "..comment, 96 | vlabel = "", 97 | number_format = "%3.1lf", 98 | data = { 99 | types = { "8xxx" }, 100 | options = { 101 | dt9xxx = { 102 | title= "8.xxx", 103 | overlay = true, 104 | color = "0000ff" 105 | } 106 | } 107 | } 108 | } 109 | local dt9xxx = { 110 | title = "%H: 9.xxx "..comment, 111 | vlabel = "degree", 112 | number_format = "%3.1lf degree", 113 | data = { 114 | types = { "9xxx" }, 115 | options = { 116 | dt9xxx = { 117 | title= "9.xxx", 118 | overlay = true, 119 | color = "0000ff" 120 | } 121 | } 122 | } 123 | } 124 | local derive = { 125 | title = "%H: receive "..comment, 126 | vlabel = "recv", 127 | number_format = "%3.1lf count", 128 | data = { 129 | types = { "derive" }, 130 | options = { 131 | derive = { 132 | title= "derive", 133 | overlay = true, 134 | color = "0000ff" 135 | } 136 | } 137 | } 138 | } 139 | 140 | local types = graph.tree:data_types( plugin, plugin_instance ) 141 | local p = {} 142 | for _, t in ipairs(types) do 143 | if t == "5xxx" then 144 | p[#p+1] = dt5xxx 145 | end 146 | if t == "5001" then 147 | p[#p+1] = dt5001 148 | end 149 | if t == "5003" then 150 | p[#p+1] = dt5003 151 | end 152 | if t == "6xxx" then 153 | p[#p+1] = dt6xxx 154 | end 155 | if t == "7xxx" then 156 | p[#p+1] = dt7xxx 157 | end 158 | if t == "8xxx" then 159 | p[#p+1] = dt8xxx 160 | end 161 | if t == "9xxx" then 162 | p[#p+1] = dt9xxx 163 | end 164 | if t == "derive" then 165 | p[#p+1] = derive 166 | end 167 | end 168 | 169 | return p 170 | end 171 | -------------------------------------------------------------------------------- /luci-app-linknx/luasrc/view/linknx_diag.htm: -------------------------------------------------------------------------------- 1 | <%# 2 | Copyright 2015 Patrick Grimm 3 | Licensed to the public under the Apache License 2.0. 4 | -%> 5 | 6 | <%+header%> 7 | 8 | 9 | 111 | 112 |
"> 113 |
114 |

<%:linknx Diagnostics%>

115 | 116 |
117 | <%:linknx Tools%> 118 | 119 |
120 | 121 |
122 |
123 | Linknx Object 124 |
125 | 126 |
127 |
128 | Linknx Object 129 | Wert 130 |
131 | 132 |
133 | 134 |
135 | 136 |

137 | 138 |
139 |
140 | 141 | 145 |
146 | 147 | <%+footer%> 148 | -------------------------------------------------------------------------------- /luci-app-modbus/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=luci-app-modbus 4 | PKG_VERSION:=0.7 5 | PKG_RELEASE:=4 6 | PKG_BUILD_DEPENDS += LUCI_APP_MODBUS_SRCDIET:luasrcdiet/host 7 | PKG_CONFIG_DEPENDS += CONFIG_LUCI_APP_MODBUS_SRCDIET 8 | PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) 9 | 10 | include $(INCLUDE_DIR)/package.mk 11 | 12 | define Package/luci-app-modbus 13 | SECTION:=luci 14 | CATEGORY:=LuCI 15 | SUBMENU:=3. Applications 16 | TITLE:=Modbus Device 17 | EXTRA_DEPENDS:=modbus-uci, luci-mod-admin-full, luci-lib-nixio 18 | endef 19 | 20 | define Package/luci-app-modbus/config 21 | config LUCI_APP_MODBUS_SRCDIET 22 | bool "modbus Minify Lua sources" 23 | default n 24 | endef 25 | 26 | define SrcDiet 27 | $(FIND) $(1) -type f -name '*.lua' | while read src; do \ 28 | if LUA_PATH="$(STAGING_DIR_HOSTPKG)/lib/lua/5.1/?.lua" luasrcdiet --noopt-binequiv -o "$$$$src.o" "$$$$src"; \ 29 | then mv "$$$$src.o" "$$$$src"; fi; \ 30 | done 31 | endef 32 | 33 | define Build/Prepare 34 | mkdir -p $(PKG_BUILD_DIR) 35 | $(CP) ./luasrc $(PKG_BUILD_DIR)/ 36 | endef 37 | 38 | define Build/Configure 39 | endef 40 | 41 | define Build/Compile 42 | $(if $(CONFIG_LUCI_APP_MODBUS_SRCDIET),$(call SrcDiet,$(PKG_BUILD_DIR)/luasrc/),true); 43 | endef 44 | 45 | define Package/luci-app-modbus/postinst 46 | #!/bin/sh 47 | [ -n "${IPKG_INSTROOT}" ] || { 48 | rm -f /tmp/luci-indexcache 49 | exit 0 50 | } 51 | endef 52 | 53 | define Package/luci-app-modbus/install 54 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller 55 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi 56 | $(CP) $(PKG_BUILD_DIR)/luasrc/controller/* $(1)/usr/lib/lua/luci/controller 57 | $(CP) $(PKG_BUILD_DIR)/luasrc/model/cbi/* $(1)/usr/lib/lua/luci/model/cbi 58 | endef 59 | 60 | $(eval $(call BuildPackage,luci-app-modbus)) 61 | -------------------------------------------------------------------------------- /luci-app-modbus/files/etc/icinga/uci_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | max=254 4 | export BACNET_BBMD_ADDRESS=127.0.0.1 5 | export BACNET_IP_PORT=47809 6 | export BACNET_BBMD_PORT=47808 7 | 8 | wget -O /tmp/host.csv 'http://icingaadmin:icingaadmin@127.0.0.1/icinga/cgi-bin/status.cgi?style=hostdetail&limit=0&start=1&csvoutput' 9 | x=0 10 | while [ $x -le $max ] ; do 11 | Name='' 12 | Name=$(uci get "bacnet_mv."$x".name" 2>/dev/null) 13 | if ! [[ $Name == '' ]] ; then 14 | line='' 15 | line=$(egrep "^.$Name" /tmp/host.csv) 16 | hostname_csv='' 17 | hostname_csv=$(echo $line | cut -d ';' -f 1) 18 | value='' 19 | value=$(echo $line | cut -d ';' -f 2) 20 | eval value=$value 21 | case $value in 22 | UP) 23 | bacwp 10001 19 $x 85 3 -1 2 1 24 | uci set bacnet_mv."$x".value=1 25 | ;; 26 | DOWN) 27 | bacwp 10001 19 $x 85 3 -1 2 2 28 | uci set bacnet_mv."$x".value=2 29 | ;; 30 | UNREACHABLE) 31 | bacwp 10001 19 $x 85 3 -1 2 3 32 | uci set bacnet_mv."$x".value=3 33 | ;; 34 | FLAPPING) 35 | bacwp 10001 19 $x 85 3 -1 2 4 36 | uci set bacnet_mv."$x".value=4 37 | ;; 38 | esac 39 | fi 40 | x=$((x+1)) 41 | done 42 | 43 | uci commit 44 | 45 | -------------------------------------------------------------------------------- /luci-app-modbus/files/lib/nagios/plugins/notify_via_bacnet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | hostname=$1 3 | state=$2 4 | max=254 5 | export BACNET_BBMD_ADDRESS=127.0.0.1 6 | export BACNET_IP_PORT=47809 7 | export BACNET_BBMD_PORT=47808 8 | x=0 9 | 10 | ( 11 | while [ $x -le $max ] 12 | do 13 | Name=$(uci get "bacnet_mv."$x".name" 2>/dev/null) 14 | if [ "$Name" == "$hostname" ] ; then 15 | case "${state}" in 16 | UP) 17 | bacwp 10001 19 $x 85 16 -1 2 1 18 | uci set "bacnet_mv."$x".value=1" 2>/dev/null 19 | ;; 20 | DOWN) 21 | bacwp 10001 19 $x 85 16 -1 2 2 22 | uci set "bacnet_mv."$x".value=2" 2>/dev/null 23 | ;; 24 | UNREACHABLE) 25 | bacwp 10001 19 $x 85 16 -1 2 3 26 | uci set "bacnet_mv."$x".value=3" 2>/dev/null 27 | ;; 28 | FLAPPING) 29 | bacwp 10001 19 $x 85 16 -1 2 4 30 | uci set "bacnet_mv."$x".value=4" 2>/dev/null 31 | ;; 32 | esac 33 | fi 34 | x=$(( $x + 1 )) 35 | done 36 | ) >>/dev/null 2>&1 37 | -------------------------------------------------------------------------------- /luci-app-modbus/luasrc/controller/modbus.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | module("luci.controller.modbus", package.seeall) 15 | 16 | function index() 17 | if not nixio.fs.access("/etc/config/modbus") then 18 | return 19 | end 20 | local page = entry({"admin", "services", "modbus"}, cbi("modbus"), "Modbus Device", 20) 21 | page.dependent = true 22 | end 23 | 24 | -------------------------------------------------------------------------------- /luci-app-modbus/luasrc/model/cbi/modbus.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LuCI - Lua Configuration Interface 3 | 4 | Copyright 2012 Patrick Grimm 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | $Id$ 13 | ]]-- 14 | 15 | local fs = require "nixio.fs" 16 | local lfs = require "nixio.fs" 17 | local uci = require "luci.model.uci".cursor() 18 | local sys = require "luci.sys" 19 | local uci_state = require "luci.model.uci".cursor_state() 20 | 21 | if not lfs.access("/etc/config/modbus") then 22 | if not luci.sys.exec("touch /etc/config/modbus") then 23 | return 24 | end 25 | end 26 | 27 | local m = Map("modbus", "Modbus Device", "Modbus Device Configuration") 28 | m.on_after_commit = function() luci.sys.call("/etc/init.d/modbus restart") end 29 | 30 | s = m:section(TypedSection, "station", 'Station') 31 | s.addremove = true 32 | s.anonymous = true 33 | 34 | s:option(Flag, "enable", "enable") 35 | 36 | s:option(Value, "tagname", "Tag Name benutzt in bacnet objects") 37 | 38 | sva = s:option(Value, "unit_id", "Standart Unit ID wenn im Bacnet objekt nicht definiert") 39 | sva.placeholder = 1 40 | sva.datatype = "range(0, 128)" 41 | 42 | sva = s:option(Value, "poll", "Poll Intervall in s") 43 | sva.placeholder = 5 44 | sva.datatype = "range(1, 128)" 45 | 46 | sva = s:option(ListValue, "backend", "Schnitstelle") 47 | sva:value("tcp","Modbus TCP/IPv4") 48 | sva:value("tcp_pi","Modbus TCP/IPv6") 49 | sva:value("rtu","Modbus RTU (RS485/RS232)") 50 | 51 | sva = s:option(Value, "ip4addr", "IPv4 Adresse") 52 | sva:depends("backend","tcp") 53 | sva.datatype = "ip4addr" 54 | 55 | sva = s:option(Value, "ip6addr", "IPv6 Adresse") 56 | sva:depends("backend","tcp_pi") 57 | sva.datatype = "ip6addr" 58 | 59 | sva = s:option(Value, "port", "TCP Port") 60 | sva:depends("backend","tcp") 61 | sva:depends("backend","tcp_pi") 62 | sva.placeholder = 502 63 | sva.datatype = "portrange" 64 | 65 | sva = s:option(Value, "ttydev", "Pfad zur tty Geraetedatei") 66 | for device in nixio.fs.glob("/dev/ttyS[0-9]*") do 67 | sva:value(device) 68 | end 69 | for device in nixio.fs.glob("/dev/ttyUSB[0-9]*") do 70 | sva:value(device) 71 | end 72 | sva:depends("backend","rtu") 73 | sva = s:option(ListValue, "baud", "Uebertragungsrate") 74 | sva:value('9600') 75 | sva:value('19200') 76 | sva:value('38400') 77 | sva:value('57600') 78 | sva:value('','115200 Default') 79 | sva:value('115200') 80 | sva:depends("backend","rtu") 81 | sva.rmempty = true 82 | sva = s:option(ListValue, "parity_bit", "Parity Bit") 83 | sva:value('','None Default') 84 | sva:value('N','None') 85 | sva:value('O','Odd') 86 | sva:value('E','Even') 87 | sva:depends("backend","rtu") 88 | sva.rmempty = true 89 | sva = s:option(ListValue, "data_bit", "Data Bit") 90 | sva:value(7) 91 | sva:value('','8 Default') 92 | sva:value(8) 93 | sva:depends("backend","rtu") 94 | sva.rmempty = true 95 | sva = s:option(ListValue, "stop_bit", "Stop Bit") 96 | sva:value('','1 Default') 97 | sva:value(1) 98 | sva:value(1.5) 99 | sva:value(2) 100 | sva:depends("backend","rtu") 101 | sva.rmempty = true 102 | 103 | 104 | s:option(Value, "modelname", "Model Name") 105 | 106 | s:option(Value, "description", "Anzeige Name") 107 | 108 | s:option(Value, "location", "Einbau Ort") 109 | 110 | return m 111 | 112 | -------------------------------------------------------------------------------- /mbus-uci/Makefile: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=mbus-uci 6 | PKG_VERSION:=0.2 7 | PKG_RELEASE:=2 8 | 9 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 10 | PKG_BUILD_DEPENDS:=libmbus 11 | 12 | include $(INCLUDE_DIR)/package.mk 13 | 14 | define Package/mbus-uci/default 15 | SECTION:=net 16 | CATEGORY:=Network 17 | TITLE:=mbus-uci gateway 18 | DEPENDS:=+libmbus +libuci +bacnet-stack-uci 19 | endef 20 | 21 | define Package/mbus-uci 22 | $(Package/mbus-uci/default) 23 | MENU:=1 24 | endef 25 | 26 | define Package/mbus-uci/description 27 | mbus-uci-gateway 28 | use libmbus http://www.rscada.se/libmbus 29 | endef 30 | 31 | define Build/Prepare 32 | mkdir -p $(PKG_BUILD_DIR) 33 | endef 34 | 35 | define Build/Configure 36 | endef 37 | 38 | define Build/Compile 39 | endef 40 | 41 | define Package/mbus-uci/conffiles 42 | /etc/config/mbus 43 | endef 44 | 45 | define Package/mbus-uci/postinst 46 | #!/bin/sh 47 | 48 | [ -n $${IPKG_INSTROOT} ] || { 49 | /etc/init.d/mbus enable 50 | /etc/init.d/mbus restart 51 | } 52 | endef 53 | 54 | define Package/mbus-uci/install 55 | $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults 56 | $(INSTALL_CONF) ./files/mbus.config $(1)/etc/config/mbus 57 | $(INSTALL_BIN) ./files/mbus.init $(1)/etc/init.d/mbus 58 | $(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/bin 59 | $(INSTALL_BIN) ./files/xml_parser.sh $(1)/usr/bin/xml_parser.sh 60 | $(INSTALL_BIN) ./files/mbus-uci.sh $(1)/usr/sbin/mbus-uci 61 | endef 62 | 63 | $(eval $(call BuildPackage,mbus-uci)) 64 | 65 | -------------------------------------------------------------------------------- /mbus-uci/files/mbus-uci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /lib/functions.sh 4 | . /usr/share/libubox/jshn.sh 5 | BIN="/usr/bin/mbus-serial-request-data" 6 | stdout=1 7 | [ "$HOME" == "/" ] && stdout=0 8 | 9 | log_mbus() { 10 | if [ "$stdout" == "1" ] ; then 11 | logger -s -t mbus $@ 12 | else 13 | logger -t mbus $@ 14 | fi 15 | } 16 | 17 | get_data() { 18 | local cfg=$1 19 | local type=$2 20 | [ "$cfg" == "default" ] && return 21 | config_get disable $cfg disable "0" 22 | [ "$disable" == "1" ] && return 23 | config_get tagname $cfg tagname "" 24 | [ "$tagname" == "$PROC_TAGNAME" ] || return 25 | config_get unit_id $cfg unit_id "1" 26 | [ -d /tmp/mbus-$PROC_TTYDEV-$unit_id ] || mkdir -p /tmp/mbus-$PROC_TTYDEV-$unit_id 27 | $BIN -b $PROC_BAUD $PROC_TTYDEV $unit_id > /tmp/mbus-$PROC_TTYDEV-$unit_id/current.xml 28 | config_get addr $cfg addr "0" 29 | value=$(/usr/bin/xml_parser.sh /tmp/mbus-$PROC_TTYDEV-$unit_id/current.xml $addr "Value") 30 | #unit=$(/usr/bin/xml_parser.sh /tmp/mbus-$PROC_TTYDEV-$unit_id/current.xml $addr "Unit") 31 | config_get oldvalue $cfg value 32 | if [ $value != $oldvalue ] ; then 33 | log_mbus "loop new value $value" 34 | uci_set bacnet_$type $cfg value "$value" 35 | uci_commit bacnet_$type 36 | fi 37 | } 38 | 39 | log_mbus "start $PROC_TAGNAME $PROC_TTYDEV $PROC_BAUD" 40 | while true; do 41 | #Load config 42 | obj_types="ai av" 43 | for type in $obj_types ; do 44 | config_load bacnet_$type 45 | config_foreach get_data $type $type 46 | done 47 | sleep 3 48 | done 49 | -------------------------------------------------------------------------------- /mbus-uci/files/mbus.config: -------------------------------------------------------------------------------- 1 | 2 | config 'station' 3 | option 'unit_id' '4' 4 | option 'enable' '1' 5 | option 'tagname' 'mbus-s3' 6 | option 'description' '9.OG Systemverteiler' 7 | option backend 'serial' 8 | option ttydev '/dev/ttyUSB0' 9 | option baud '2400' 10 | -------------------------------------------------------------------------------- /mbus-uci/files/mbus.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2013 Patrick Grimm 3 | 4 | START=60 5 | USE_PROCD=1 6 | SERVER_BIN="/usr/sbin/mbus-uci" 7 | 8 | 9 | start_dev() { 10 | local cfg=$1 11 | config_get enable $cfg enable "0" 12 | [ "$enable" == "1" ] || return 13 | config_get backend $cfg backend "serial" 14 | #BIN="$SERVER_BIN-$backend" 15 | BIN="$SERVER_BIN" 16 | [ -f "$BIN" ] || return 17 | config_get tagname $cfg tagname "mbus-$cfg" 18 | config_get ttydev $cfg ttydev "/dev/ttyUSB0" 19 | config_get baud $cfg baud "2400" 20 | procd_open_instance 21 | procd_set_param respawn 22 | procd_set_param stderr 1 23 | procd_set_param command "$BIN" 24 | procd_set_param env \ 25 | PROC_TAGNAME="$tagname" \ 26 | PROC_TTYDEV="$ttydev" \ 27 | PROC_BAUD="$baud" 28 | procd_open_trigger 29 | procd_add_raw_trigger "interface.*" 2000 /etc/init.d/mbus restart 30 | config_files="network mbus bacnet_ai bacnet_av" 31 | for file in $config_files ; do 32 | if [ -f "/etc/config/$file" ] ; then 33 | procd_add_config_trigger "config.change" "$file" /etc/init.d/mbus restart 34 | fi 35 | done 36 | procd_close_trigger 37 | procd_close_instance 38 | } 39 | 40 | start_service() { 41 | config_load mbus 42 | config_foreach start_dev station 43 | } 44 | 45 | stop_service() { 46 | killall mbus-uci 47 | } -------------------------------------------------------------------------------- /mbus-uci/files/xml_parser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$1" != "" ] ; then 4 | xmlpath=$1 5 | else 6 | return 7 | fi 8 | if [ "$2" != "" ] ; then 9 | addr=$2 10 | else 11 | addr=0 12 | fi 13 | if [ "$3" != "" ] ; then 14 | tagname=$3 15 | else 16 | tagname="Value" 17 | fi 18 | 19 | find=0 20 | xmobj=$(grep -A 7 "id=\"$addr\"" $xmlpath) 21 | echo "$xmobj" | grep \<$tagname\> | sed -e "s/.*<$tagname>\(.*\)<\/$tagname>.*/\1/" 22 | -------------------------------------------------------------------------------- /modbus-uci/Makefile: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=modbus-uci 6 | PKG_VERSION:=0.8 7 | PKG_RELEASE:=5 8 | 9 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 10 | PKG_BUILD_DEPENDS:=libmodbus 11 | 12 | include $(INCLUDE_DIR)/package.mk 13 | 14 | define Package/modbus-uci/default 15 | SECTION:=net 16 | CATEGORY:=Network 17 | TITLE:=modbus-uci gateway 18 | DEPENDS:=+libmodbus +libuci 19 | endef 20 | 21 | define Package/modbus-uci 22 | $(Package/modbus-uci/default) 23 | MENU:=1 24 | endef 25 | 26 | define Package/modbus-uci/description 27 | modbus-uci-gateway 28 | use libmodbus https://github.com/stephane/libmodbus 29 | endef 30 | 31 | define Build/Prepare 32 | mkdir -p $(PKG_BUILD_DIR) 33 | $(CP) ./src/* $(PKG_BUILD_DIR)/ 34 | endef 35 | 36 | define Package/modbus-uci/conffiles 37 | /etc/config/modbus 38 | endef 39 | 40 | define Package/modbus-uci/postinst 41 | #!/bin/sh 42 | 43 | [ -n $${IPKG_INSTROOT} ] || { 44 | /etc/init.d/modbus enable 45 | /etc/init.d/modbus restart 46 | } 47 | endef 48 | 49 | define Package/modbus-uci/install 50 | $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/etc/uci-defaults 51 | $(INSTALL_CONF) ./files/modbus.config $(1)/etc/config/modbus 52 | $(INSTALL_BIN) ./files/modbus.init $(1)/etc/init.d/modbus 53 | $(INSTALL_DIR) $(1)/usr/sbin 54 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/modbus-uci $(1)/usr/sbin/modbus-uci 55 | endef 56 | 57 | $(eval $(call BuildPackage,modbus-uci)) 58 | 59 | -------------------------------------------------------------------------------- /modbus-uci/files/modbus.config: -------------------------------------------------------------------------------- 1 | 2 | config station 3 | option port '502' 4 | option poll '5' 5 | option unit_id '1' 6 | option tagname 'modbus-s1' 7 | option description '8.OG Systemverteiler 1 Hotelzimmer' 8 | option csv '/etc/modbus-s1.csv' 9 | option enable '1' 10 | option backend 'tcp' 11 | option ip4addr '192.168.150.210' 12 | 13 | config station 14 | option port '502' 15 | option poll '5' 16 | option unit_id '1' 17 | option tagname 'modbus-s2' 18 | option description '8.OG Systemverteiler 2 Hotelzimmer' 19 | option csv '/etc/modbus-s2.csv' 20 | option enable '1' 21 | option backend 'tcp' 22 | option ip4addr '192.168.150.211' 23 | 24 | config 'station' 25 | option poll '5' 26 | option 'unit_id' '4' 27 | option 'enable' '0' 28 | option 'tagname' 'modbus-s3' 29 | option 'description' '9.OG Systemverteiler' 30 | option 'csv' '/etc/modbus-s2.csv' 31 | option backend 'rtu' 32 | option ttydev '/dev/tty.usbserial-1420' 33 | option baud '115200' 34 | option parity_bit 'N' 35 | option data_bit '8' 36 | option stop_bit '1' 37 | 38 | config 'station' 39 | option 'port' '502' 40 | option poll '5' 41 | option 'unit_id' '1' 42 | option 'enable' '0' 43 | option 'tagname' 'modbus-s4' 44 | option 'description' '10.OG Systemverteiler' 45 | option 'csv' '/etc/modbus-s3.csv' 46 | option backend 'tcppi' 47 | option ip6addr 'fe80::1' 48 | -------------------------------------------------------------------------------- /modbus-uci/files/modbus.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2013 Patrick Grimm 3 | 4 | START=60 5 | USE_PROCD=1 6 | SERVER_BIN="/usr/sbin/modbus-uci" 7 | 8 | 9 | start_service() { 10 | procd_open_instance 11 | #procd_set_param respawn 12 | procd_set_param stderr 1 13 | procd_set_param command "$SERVER_BIN" 14 | procd_open_trigger 15 | procd_add_raw_trigger "interface.*" 2000 /etc/init.d/modbus restart 16 | config_files="network modbus bacnet_ai bacnet_ao bacnet_av bacnet_bi \ 17 | bacnet_bo bacnet_bv bacnet_mi bacnet_mo bacnet_mv" 18 | for file in $config_files ; do 19 | if [ -f "/etc/config/$file" ] ; then 20 | procd_add_config_trigger "config.change" "$file" /etc/init.d/modbus restart 21 | fi 22 | done 23 | procd_close_trigger 24 | procd_close_instance 25 | } 26 | 27 | stop_service() { 28 | killall modbus-uci 29 | } 30 | -------------------------------------------------------------------------------- /modbus-uci/src/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS += -Wall -std=gnu99 -pedantic 3 | OBJ = modbus-uci.o 4 | OBJ-L = ucix.o 5 | LIB = -lmodbus -luci 6 | 7 | %.o: %.c 8 | $(CC) $(CFLAGS) -c -o $@ $< 9 | 10 | compile: $(OBJ) 11 | $(CC) -o modbus-uci $(LDFLAGS) $(LIB) $(OBJ) 12 | 13 | compile: $(OBJ-L) $(OBJ) 14 | $(CC) -o modbus-uci $(LDFLAGS) $(LIB) $(OBJ-L) $(OBJ) 15 | 16 | clean: 17 | rm -f *.o *.so modbus-uci 18 | -------------------------------------------------------------------------------- /modbus-uci/src/README: -------------------------------------------------------------------------------- 1 | Compilation 2 | ----------- 3 | 4 | After installation, you can use pkg-config to compile these tests. 5 | For example, to compile random-test-server run: 6 | 7 | gcc random-test-server.c -o random-test-server `pkg-config --libs --cflags libmodbus` 8 | 9 | random-test-server 10 | ----------------- 11 | It's necessary to launch this server before run random-test-client. By 12 | default, it receives and responses to Modbus query on the localhost 13 | and port 1502. 14 | 15 | random-test-client 16 | ------------------ 17 | This programm sends many different queries to a large range of 18 | addresses and values to test the communication between the client and 19 | the server. 20 | 21 | unit-test-server 22 | unit-test-client 23 | ---------------- 24 | By default, this program sends some queries with the values defined in 25 | unit-test.h and checks the responses. These programs are useful to 26 | test the protocol implementation. 27 | 28 | bandwidth-server-one 29 | bandwidth-server-many-up 30 | bandwidth-client 31 | ----------------------- 32 | It returns some very useful informations about the performance of 33 | transfert rate between the server and the client. 34 | 35 | - bandwidth-server-one: it can handles only one connection with a client. 36 | - bandwidth-server-many-up: it opens a connection each time a new client asks 37 | for, but the number of connection is limited. The same server process handles 38 | all the connections. 39 | -------------------------------------------------------------------------------- /modbus-uci/src/SAIA_Modbus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stargieg/packages-automation/22fed364225ae4bd51364a0e96d52f74df40b198/modbus-uci/src/SAIA_Modbus.pdf -------------------------------------------------------------------------------- /modbus-uci/src/ucix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This program is free software; you can redistribute it and/or modify 3 | * it under the terms of the GNU General Public License as published by 4 | * the Free Software Foundation; either version 2 of the License, or 5 | * (at your option) any later version. 6 | * 7 | * This program is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | * GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License 13 | * along with this program; if not, write to the Free Software 14 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 15 | * 16 | * Copyright (C) 2008 John Crispin 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | #ifndef _UCI_H__ 23 | #define _UCI_H__ 24 | struct uci_context* ucix_init(const char *config_file); 25 | struct uci_context* ucix_init_path(const char *path, const char *config_file); 26 | 27 | /* value/name tuples */ 28 | struct value_tuple { 29 | char value[16]; 30 | time_t value_time; 31 | int Out_Of_Service; 32 | char idx[18]; 33 | struct value_tuple *next; 34 | }; 35 | 36 | /* structure to hold tuple-list and uci context during iteration */ 37 | struct uci_itr_ctx { 38 | struct value_tuple *list; 39 | struct uci_context *ctx; 40 | char *section; 41 | }; 42 | typedef struct value_tuple value_tuple_t; 43 | 44 | void ucix_cleanup(struct uci_context *ctx); 45 | void ucix_save(struct uci_context *ctx, const char *p); 46 | void ucix_save_state(struct uci_context *ctx, const char *p); 47 | const char* ucix_get_option(struct uci_context *ctx, 48 | const char *p, const char *s, const char *o); 49 | int ucix_get_list(char *value[254], struct uci_context *ctx, 50 | const char *p, const char *s, const char *o); 51 | int ucix_get_option_int(struct uci_context *ctx, 52 | const char *p, const char *s, const char *o, int def); 53 | void ucix_add_section(struct uci_context *ctx, 54 | const char *p, const char *s, const char *t); 55 | void ucix_add_option_int(struct uci_context *ctx, 56 | const char *p, const char *s, const char *o, int t); 57 | void ucix_add_option(struct uci_context *ctx, 58 | const char *p, const char *s, const char *o, const char *t); 59 | void ucix_set_list(struct uci_context *ctx, 60 | const char *p, const char *s, const char *o, char value[254][64], int l); 61 | int ucix_commit(struct uci_context *ctx, const char *p); 62 | void ucix_revert(struct uci_context *ctx, 63 | const char *p, const char *s, const char *o); 64 | void ucix_del(struct uci_context *ctx, const char *p, 65 | const char *s, const char *o); 66 | bool ucix_string_copy(char *dest, size_t i, char *src); 67 | void ucix_for_each_section_type(struct uci_context *ctx, 68 | const char *p, const char *t, 69 | void (*cb)(const char*, void*), void *priv); 70 | /* Check if given uci file was updated */ 71 | time_t check_uci_update(const char *config, time_t mtime); 72 | /* Add tuple */ 73 | void load_value(const char *sec_idx, struct uci_itr_ctx *itr); 74 | //void load_station(const char *sec_idx, struct tname_itr_ctx *itr); 75 | #endif 76 | -------------------------------------------------------------------------------- /node-homebridge-knx/Makefile: -------------------------------------------------------------------------------- 1 | # call BuildPackage - OpenWrt buildroot signature 2 | include $(TOPDIR)/rules.mk 3 | 4 | PKG_NPM_NAME:=homebridge-knx 5 | PKG_NAME:=node-$(PKG_NPM_NAME) 6 | PKG_VERSION:=0.3.27 7 | PKG_RELEASE:=1 8 | PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz 9 | PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ 10 | PKG_HASH:=01a216999727cc860c58f2e17c47de17f87378571cf277b5a9186d5fe0ae9938 11 | 12 | PKG_BUILD_DEPENDS:=node/host 13 | PKG_USE_MIPS16:=0 14 | 15 | PKG_MAINTAINER:=Hirokazu MORIKAWA 16 | PKG_LICENSE:=ISC Apache-2.0 17 | PKG_LICENSE_FILES:=LICENSE 18 | 19 | include $(INCLUDE_DIR)/package.mk 20 | 21 | define Package/node-homebridge-knx 22 | SECTION:=lang 23 | CATEGORY:=Languages 24 | SUBMENU:=Node.js 25 | TITLE:=hombridge shim for KNX home automation 26 | DEPENDS:=+node +node-npm 27 | EXTRA_DEPENDS:=node-homebridge 28 | USERID:=homebridge:homebridge 29 | endef 30 | 31 | 32 | TAR_OPTIONS+= --strip-components 1 33 | TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) 34 | 35 | NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) 36 | TMPNPM:=$(shell mktemp -u XXXXXXXXXX) 37 | 38 | TARGET_CFLAGS+=$(FPIC) 39 | TARGET_CPPFLAGS+=$(FPIC) 40 | 41 | define Build/Compile 42 | $(MAKE_VARS) \ 43 | $(MAKE_FLAGS) \ 44 | npm_config_arch=$(NODEJS_CPU) \ 45 | npm_config_target_arch=$(NODEJS_CPU) \ 46 | npm_config_build_from_source=true \ 47 | npm_config_nodedir=$(STAGING_DIR)/usr/ \ 48 | npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ 49 | npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ 50 | npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ 51 | npm install -g $(PKG_BUILD_DIR) 52 | rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) 53 | rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) 54 | endef 55 | 56 | define Package/$(PKG_NAME)/postinst 57 | cd $${IPKG_INSTROOT}/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/node_modules 58 | for i in * ; do 59 | ln -s $(PKG_NPM_NAME)/node_modules/$$i ../../ 60 | done 61 | if [ -d .bin ] ; then 62 | mkdir -p ../../.bin 63 | cd .bin 64 | for i in * ; do 65 | ln -s ../$(PKG_NPM_NAME)/node_modules/.bin/$$i ../../../.bin/ 66 | done 67 | fi 68 | exit 0 69 | endef 70 | 71 | define Package/node-homebridge-knx/install 72 | $(INSTALL_DIR) $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME) 73 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib,custom} \ 74 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 75 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{*.json,*.md,*.js} \ 76 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 77 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/LICENSE \ 78 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 79 | endef 80 | 81 | $(eval $(call BuildPackage,node-homebridge-knx)) 82 | -------------------------------------------------------------------------------- /node-homebridge-mpd/Makefile: -------------------------------------------------------------------------------- 1 | # call BuildPackage - OpenWrt buildroot signature 2 | include $(TOPDIR)/rules.mk 3 | 4 | PKG_NPM_NAME:=homebridge-mpd 5 | PKG_NAME:=node-$(PKG_NPM_NAME) 6 | PKG_VERSION:=0.0.13 7 | PKG_RELEASE:=1 8 | PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz 9 | PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ 10 | PKG_HASH:=344d9fca5da5f7c5ec6ec85a2d4370abc261cac85e3ece1115f4c5b27ad77c7f 11 | 12 | PKG_BUILD_DEPENDS:=node/host 13 | PKG_USE_MIPS16:=0 14 | 15 | PKG_MAINTAINER:=Hirokazu MORIKAWA 16 | PKG_LICENSE:=ISC Apache-2.0 17 | PKG_LICENSE_FILES:=LICENSE 18 | 19 | include $(INCLUDE_DIR)/package.mk 20 | 21 | define Package/node-homebridge-mpd 22 | SECTION:=lang 23 | CATEGORY:=Languages 24 | SUBMENU:=Node.js 25 | TITLE:=hombridge shim for mpd 26 | DEPENDS:=+node +node-npm 27 | EXTRA_DEPENDS:=node-homebridge 28 | USERID:=homebridge:homebridge 29 | endef 30 | 31 | 32 | TAR_OPTIONS+= --strip-components 1 33 | TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) 34 | 35 | NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) 36 | TMPNPM:=$(shell mktemp -u XXXXXXXXXX) 37 | 38 | TARGET_CFLAGS+=$(FPIC) 39 | TARGET_CPPFLAGS+=$(FPIC) 40 | 41 | define Build/Compile 42 | $(MAKE_VARS) \ 43 | $(MAKE_FLAGS) \ 44 | npm_config_arch=$(NODEJS_CPU) \ 45 | npm_config_target_arch=$(NODEJS_CPU) \ 46 | npm_config_build_from_source=true \ 47 | npm_config_nodedir=$(STAGING_DIR)/usr/ \ 48 | npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ 49 | npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ 50 | npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ 51 | npm install -g $(PKG_BUILD_DIR) 52 | rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) 53 | rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) 54 | endef 55 | 56 | define Package/$(PKG_NAME)/postinst 57 | cd $${IPKG_INSTROOT}/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/node_modules 58 | for i in * ; do 59 | ln -s $(PKG_NPM_NAME)/node_modules/$$i ../../ 60 | done 61 | exit 0 62 | endef 63 | 64 | define Package/node-homebridge-mpd/install 65 | $(INSTALL_DIR) $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME) 66 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{*.json,*.md,*.js} \ 67 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 68 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/LICENSE \ 69 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 70 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/node_modules \ 71 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 72 | endef 73 | 74 | $(eval $(call BuildPackage,node-homebridge-mpd)) 75 | -------------------------------------------------------------------------------- /node-homebridge-mpd/patches/000-add-volumen-control.patch: -------------------------------------------------------------------------------- 1 | From 491a52b87912be463cf671b0f0f7bbf12d5ca16d Mon Sep 17 00:00:00 2001 2 | From: Patrick Grimm 3 | Date: Wed, 23 Dec 2020 15:20:05 +0100 4 | Subject: [PATCH] FIX missing volume control 5 | 6 | Issue #3 7 | --- 8 | index.js | 4 ++-- 9 | 1 file changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/index.js b/index.js 12 | index a5ee141..04b0d04 100644 13 | --- a/index.js 14 | +++ b/index.js 15 | @@ -23,7 +23,7 @@ function MpdAccessory(log, config) { 16 | host: this.host, 17 | }); 18 | 19 | - this.service = new Service.Switch(this.name); 20 | + this.service = new Service.Lightbulb(this.name); 21 | 22 | this.service 23 | .getCharacteristic(Characteristic.On) 24 | @@ -110,4 +110,4 @@ MpdAccessory.prototype.setVolume = function(volume, callback) { 25 | callback(null); 26 | } 27 | }); 28 | -} 29 | \ No newline at end of file 30 | +} 31 | -------------------------------------------------------------------------------- /node-homebridge-mqtt/Makefile: -------------------------------------------------------------------------------- 1 | # call BuildPackage - OpenWrt buildroot signature 2 | include $(TOPDIR)/rules.mk 3 | 4 | PKG_NPM_NAME:=homebridge-mqtt 5 | PKG_NAME:=node-$(PKG_NPM_NAME) 6 | PKG_VERSION:=0.6.2 7 | PKG_RELEASE:=1 8 | PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz 9 | PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ 10 | PKG_HASH:=c82b887791277caf1f0cfcaa538409ca177c6162738e80b6f97ad58e485d6986 11 | 12 | PKG_BUILD_DEPENDS:=node/host 13 | PKG_USE_MIPS16:=0 14 | 15 | PKG_MAINTAINER:=Hirokazu MORIKAWA 16 | PKG_LICENSE:=ISC Apache-2.0 17 | PKG_LICENSE_FILES:=LICENSE 18 | 19 | include $(INCLUDE_DIR)/package.mk 20 | 21 | define Package/node-homebridge-mqtt 22 | SECTION:=lang 23 | CATEGORY:=Languages 24 | SUBMENU:=Node.js 25 | TITLE:=hombridge shim for mqtt 26 | DEPENDS:=+node +node-npm 27 | EXTRA_DEPENDS:=node-homebridge 28 | USERID:=homebridge:homebridge 29 | endef 30 | 31 | 32 | TAR_OPTIONS+= --strip-components 1 33 | TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) 34 | 35 | NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) 36 | TMPNPM:=$(shell mktemp -u XXXXXXXXXX) 37 | 38 | TARGET_CFLAGS+=$(FPIC) 39 | TARGET_CPPFLAGS+=$(FPIC) 40 | 41 | define Build/Compile 42 | $(MAKE_VARS) \ 43 | $(MAKE_FLAGS) \ 44 | npm_config_arch=$(NODEJS_CPU) \ 45 | npm_config_target_arch=$(NODEJS_CPU) \ 46 | npm_config_build_from_source=true \ 47 | npm_config_nodedir=$(STAGING_DIR)/usr/ \ 48 | npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ 49 | npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ 50 | npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ 51 | npm install -g $(PKG_BUILD_DIR) 52 | rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) 53 | rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) 54 | endef 55 | 56 | define Package/$(PKG_NAME)/postinst 57 | cd $${IPKG_INSTROOT}/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/node_modules 58 | for i in * ; do 59 | ln -s $(PKG_NPM_NAME)/node_modules/$$i ../../ 60 | done 61 | exit 0 62 | endef 63 | 64 | define Package/node-homebridge-mqtt/install 65 | $(INSTALL_DIR) $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME) 66 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \ 67 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 68 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{*.json,*.md,*.js} \ 69 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 70 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/LICENSE \ 71 | $(1)/usr/lib/node/homebridge/node_modules/$(PKG_NPM_NAME)/ 72 | endef 73 | 74 | $(eval $(call BuildPackage,node-homebridge-mqtt)) 75 | -------------------------------------------------------------------------------- /piface-util/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2012-2013 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=piface-util 11 | PKG_VERSION:=0.1 12 | PKG_RELEASE:=1 13 | 14 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 15 | 16 | include $(INCLUDE_DIR)/package.mk 17 | 18 | define Package/piface-util/default 19 | SECTION:=net 20 | CATEGORY:=Network 21 | SUBMENU:=Web Servers/Proxies 22 | TITLE:=piface-util 23 | DEPENDS:=+libpiface 24 | endef 25 | 26 | define Package/piface-util 27 | $(Package/piface-util/default) 28 | MENU:=1 29 | endef 30 | 31 | define Package/piface-util/description 32 | piface-util dep on libpiface 33 | endef 34 | 35 | define Build/Prepare 36 | mkdir -p $(PKG_BUILD_DIR) 37 | $(CP) ./src/* $(PKG_BUILD_DIR)/ 38 | endef 39 | 40 | define Package/piface-util/install 41 | $(INSTALL_DIR) $(1)/usr/bin 42 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/input_reader $(1)/usr/bin/ 43 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/the_amazing_led_show $(1)/usr/bin/ 44 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/board_reset $(1)/usr/bin/ 45 | endef 46 | 47 | $(eval $(call BuildPackage,piface-util)) 48 | -------------------------------------------------------------------------------- /piface-util/src/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS += -Wall 2 | LIB = -lpiface-1.0 3 | OBJ_IR = input_reader.o 4 | OBJ_TALS = the_amazing_led_show.o 5 | OBJ_BR = board_reset.o 6 | 7 | %.o: %.c 8 | $(CC) $(CFLAGS) -c -o $@ $< 9 | 10 | 11 | compile: $(OBJ_IR) $(OBJ_TALS) $(OBJ_BR) 12 | $(CC) -o input_reader $(LIB) $(OBJ_IR) 13 | $(CC) -o the_amazing_led_show $(LIB) $(OBJ_TALS) 14 | $(CC) -o board_reset $(LIB) $(OBJ_BR) 15 | 16 | clean: 17 | rm *.o 18 | -------------------------------------------------------------------------------- /piface-util/src/Makefile.old: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS += -Wall -std=gnu99 -pedantic -DDATADIR=\"/www\" -DCONFIGDIR=\"/etc\" 3 | OBJ = ws-mirror-server.o 4 | OBJ_UBUS = ws-mirror-server-ubus.o 5 | LIB = -lwebsockets -lz -lubus -lubox -lblobmsg_json -ljson 6 | 7 | %.o: %.c 8 | $(CC) $(CFLAGS) -c -o $@ $< 9 | 10 | compile: $(OBJ) $(OBJ_UBUS) 11 | $(CC) -o ws-mirror-server $(LDFLAGS) $(LIB) $(OBJ) 12 | $(CC) -o ws-mirror-server-ubus $(LDFLAGS) $(LIB) $(OBJ_UBUS) 13 | 14 | 15 | clean: 16 | rm -f *.o *.so ws-mirror-server ws-mirror-server-cmd ws-mirror-server-ubus 17 | 18 | -------------------------------------------------------------------------------- /piface-util/src/board_reset.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | if (pfio_init() < 0) 6 | exit(-1); 7 | 8 | pfio_deinit(); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /piface-util/src/input_reader.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | if (pfio_init() < 0) 7 | exit(-1); 8 | 9 | while (1) 10 | { 11 | printf("Input port: 0x%x\n", pfio_read_input()); 12 | sleep(1); 13 | } 14 | 15 | pfio_deinit(); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /piface-util/src/the_amazing_led_show.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | if (pfio_init() < 0) 7 | exit(-1); 8 | 9 | char patterns[] = {0x1, 0xc, 0xd, 0x3, 0x1, 0x2, 0x4, 0x5, 0x6, 0x7}; 10 | 11 | int i; 12 | for (i = 0; i < ARRAY_SIZE(patterns); i++) 13 | { 14 | pfio_write_output(patterns[i]); 15 | sleep(1); 16 | } 17 | 18 | pfio_deinit(); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /ws-mirror-server/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=ws-mirror-server 4 | PKG_VERSION:=0.9 5 | PKG_RELEASE:=0 6 | 7 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 8 | 9 | include $(INCLUDE_DIR)/package.mk 10 | 11 | define Package/ws-mirror-server/default 12 | SECTION:=net 13 | CATEGORY:=Network 14 | SUBMENU:=Web Servers/Proxies 15 | TITLE:=ws-mirror-server - Websocket Mirror Server for js chat 16 | DEPENDS:=+libwebsockets +zlib \ 17 | +libubox +libubus +ubusd +libblobmsg-json \ 18 | +px5g +uhttpd 19 | endef 20 | 21 | define Package/ws-mirror-server 22 | $(Package/ws-mirror-server/default) 23 | MENU:=1 24 | endef 25 | 26 | define Package/ws-mirror-server/description 27 | ws-mirror-server Websocket Mirror Server for js chat 28 | use libwebsockets http://git.warmcat.com/cgi-bin/cgit/libwebsockets 29 | endef 30 | 31 | define Build/Prepare 32 | mkdir -p $(PKG_BUILD_DIR) 33 | $(CP) ./src/Makefile $(PKG_BUILD_DIR)/ 34 | $(CP) ./src/*.c $(PKG_BUILD_DIR)/ 35 | endef 36 | 37 | define Package/ws-mirror-server/postinst 38 | #!/bin/sh 39 | if [ -z $${IPKG_INSTROOT} ] ; then 40 | /etc/init.d/ws-mirror-server enable 41 | /etc/init.d/ws-mirror-server start 42 | fi 43 | endef 44 | 45 | define Package/ws-mirror-server/install 46 | $(INSTALL_DIR) $(1)/etc/init.d 47 | $(INSTALL_BIN) ./files/ws-mirror-server.init $(1)/etc/init.d/ws-mirror-server 48 | $(INSTALL_DIR) $(1)/usr/sbin 49 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ws-mirror-server $(1)/usr/sbin/ 50 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/ws-mirror-server-ubus $(1)/usr/sbin/ 51 | $(INSTALL_DIR) $(1)/www/ws-chat 52 | $(INSTALL_DATA) ./files/cascade.css $(1)/www/ws-chat 53 | $(INSTALL_DATA) ./files/chat.js $(1)/www/ws-chat 54 | $(INSTALL_DATA) ./files/favicon.ico $(1)/www/ws-chat 55 | $(INSTALL_DATA) ./files/index.html $(1)/www/ws-chat 56 | $(INSTALL_DATA) ./files/mobile.css $(1)/www/ws-chat 57 | endef 58 | 59 | $(eval $(call BuildPackage,ws-mirror-server)) 60 | -------------------------------------------------------------------------------- /ws-mirror-server/files/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stargieg/packages-automation/22fed364225ae4bd51364a0e96d52f74df40b198/ws-mirror-server/files/favicon.ico -------------------------------------------------------------------------------- /ws-mirror-server/files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libwebsockets - Chat 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 | libwebsockets Chat Server 17 | 19 |
20 |
21 |
22 |
23 |

Detected Browser:
...

24 | console:
25 | # ubus listen
26 | # ubus send chat '{ "id": "1234","nick": "icke","msg": "und er" }'
27 | 28 | 29 | 30 | 31 |
Not initialized
32 |

Nick Liste

33 |
    34 |
35 | 36 | 37 | 38 | 39 |
40 |

Chat Console

41 |
    42 |
43 | 44 | 45 | 46 | 47 |
48 | 49 | 50 | 51 | 52 | 54 |

55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /ws-mirror-server/files/mobile.css: -------------------------------------------------------------------------------- 1 | header h3 a, header .brand { 2 | display:none !important; 3 | } 4 | 5 | @media screen and (max-device-width: 600px) { 6 | #maincontent.container { 7 | margin-top: 30px; 8 | } 9 | } 10 | 11 | @media screen and (max-device-width: 360px) { 12 | #maincontent.container { 13 | margin-top: 60px; 14 | } 15 | } 16 | 17 | @media screen and (max-device-width: 200px) { 18 | #maincontent.container { 19 | margin-top: 230px; 20 | } 21 | } -------------------------------------------------------------------------------- /ws-mirror-server/files/ws-mirror-server.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2016 Patrick Grimm 3 | 4 | START=45 5 | USE_PROCD=1 6 | SERVER="ws-mirror-server" 7 | SERVER_BIN="/usr/sbin/ws-mirror-server" 8 | SERVER_UBUS="ws-mirror-server-ubus" 9 | SERVER_UBUS_BIN="/usr/sbin/ws-mirror-server-ubus" 10 | PX5G_BIN="/usr/sbin/px5g" 11 | 12 | generate_keys_pem() { 13 | local cfg="$1" 14 | local key="$2" 15 | local crt="$3" 16 | local days bits country state location commonname 17 | 18 | config_get days "$cfg" days 19 | config_get bits "$cfg" bits 20 | config_get country "$cfg" country 21 | config_get state "$cfg" state 22 | config_get location "$cfg" location 23 | config_get commonname "$cfg" commonname 24 | 25 | [ -x "$PX5G_BIN" ] && { 26 | $PX5G_BIN selfsigned -pem \ 27 | -days ${days:-730} -newkey rsa:${bits:-1024} -keyout "${UHTTPD_KEY}.new" -out "${UHTTPD_CERT}.new" \ 28 | -subj /C="${country:-DE}"/ST="${state:-Preussen}"/L="${location:-Berlin}"/CN="${commonname:-OpenWrt}" 29 | sync 30 | mv "${UHTTPD_KEY}.new" "${UHTTPD_KEY}" 31 | mv "${UHTTPD_CERT}.new" "${UHTTPD_CERT}" 32 | } 33 | } 34 | 35 | check_keys() 36 | { 37 | UHTTPD_CERT="" 38 | UHTTPD_KEY="" 39 | local cfg="$1" 40 | 41 | config_get UHTTPD_KEY "$cfg" key /etc/uhttpd.key 42 | config_get UHTTPD_CERT "$cfg" cert /etc/uhttpd.crt 43 | 44 | grep -q CERT "$UHTTPD_CERT" || { 45 | config_foreach generate_keys_pem cert 46 | } 47 | grep -q KEY "$UHTTPD_KEY" || { 48 | config_foreach generate_keys_pem cert 49 | } 50 | procd_append_param command -k "$UHTTPD_KEY" 51 | procd_append_param command -c "$UHTTPD_CERT" 52 | } 53 | 54 | start_service() { 55 | procd_open_instance 56 | procd_set_param respawn 57 | procd_set_param stderr 1 58 | procd_set_param command "$SERVER_BIN" 59 | procd_append_param command -x ws 60 | procd_append_param command -p 7682 61 | procd_append_param command --ssl 62 | config_load uhttpd 63 | config_foreach check_keys uhttpd 64 | procd_close_instance 65 | 66 | procd_open_instance 67 | procd_set_param respawn 68 | procd_set_param stderr 1 69 | procd_set_param command "$SERVER_UBUS_BIN" 70 | procd_append_param command 127.0.0.1 71 | procd_append_param command -r chat 72 | procd_append_param command -p 7682 73 | procd_append_param command --ssl 74 | procd_close_instance 75 | } 76 | -------------------------------------------------------------------------------- /ws-mirror-server/src/Makefile: -------------------------------------------------------------------------------- 1 | #Test 2 | CFLAGS += -Wall -std=gnu99 -pedantic -DDATADIR=\"/www/ws-chat\" -DCONFIGDIR=\"/etc\" 3 | OBJ = ws-mirror-server.o 4 | OBJ_UBUS = ws-mirror-server-ubus.o 5 | LIB = -lwebsockets -lz -lubus -lubox -lblobmsg_json 6 | 7 | %.o: %.c 8 | $(CC) $(CFLAGS) -c -o $@ $< 9 | 10 | compile: $(OBJ) $(OBJ_UBUS) 11 | $(CC) -o ws-mirror-server $(LDFLAGS) $(LIB) $(OBJ) 12 | $(CC) -o ws-mirror-server-ubus $(LDFLAGS) $(LIB) $(OBJ_UBUS) 13 | 14 | 15 | clean: 16 | rm -f *.o *.so ws-mirror-server ws-mirror-server-cmd ws-mirror-server-ubus 17 | 18 | --------------------------------------------------------------------------------