HAS (Home Automation System)############################HAS is a library implementng the event driven manager talking to different drivers responsible for home automation appliances.Python 3.3 is required.Currently only the driver for Fibaro HC2 (Home Center) is implemented.Installation------------To install the library:: git clone http://github.com/kstaniek/has cd has python3 setup.py installDemo application----------------Update the manager.ini file in examples directory:: [driver1.HC2Driver] # update with your HC number (taken from configuration panel of HC2 ) network = HC2-xxxxxx # update your username username = admin # update your password password = admin # ip address of hc2 i.e. 192.168.1.1 ip = <hc2 ip address> port = 80 # change to True if you want to acccess HC2 through remote access cloud service offered by Fibaro remote = False remote_server = dom.fibaro.com # update with remote user name remote_username = <remote user> # update with remote passowrd remote_password = <remote password>Event logger This application log on the screen all the events reported by HC2 related to the node value changes:: cd examples ./event_logger.py*HC2 Demo* This application uses Tkinter library to provide GUI. It discoveries all the devices and variables and present it in the tree form. All the value changes are reflected on the list:: cd examples ./hc2_demo.pyVariable state change reporting-------------------------------Current HC2 GUI implementation is limited to reporting only the Z-Wave nodes property changes.The variable changes are not reported through /api/refreshStates mechanism.To overcome this limitation the workaround can be implemented usingthe log property to report the variable changes within /api/refreshStates reports.The solution consists of one scene and one virtual device.The scene code:: --[[ %% globals <add variable names here to be reported> --]] local eventSource = fibaro:getSourceTrigger() local type = tostring(eventSource['type']) if type == "global" then local variable_name = tostring(eventSource['name']) fibaro:debug(variable_name) local variable_log = tostring(fibaro:getGlobalValue("VARIABLELOG")) fibaro:debug(variable_log) while variable_log ~= "" do fibaro:sleep(100) variable_log = tostring(fibaro:getGlobalValue("VARIABLELOG")) end fibaro:setGlobal("VARIABLELOG", variable_name) fibaro:call(176, "pressButton", "1") endThis virtual device is used to be able to report state changeto GUI (and /api/refreshStates) through 'log' property:: local variable_name = fibaro:getGlobalValue("VARIABLELOG") if variable_name ~= "" then local variable_value = fibaro:getGlobalValue(variable_name) local table = {} local variable = {} table[variable_name] = variable_value variable['var'] = table local str = json.encode(variable) fibaro:log(str) fibaro:setGlobal("VARIABLELOG","") endCredits-------Main Author: Klaudiusz Staniek klaudiusz (at) staniek.name
Home Automation System
License
kstaniek/has
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Home Automation System
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published