Compare commits
58 Commits
Author | SHA1 | Date | |
---|---|---|---|
157ff06ba0 | |||
1cc8df148d | |||
9e06629595 | |||
77dd5c32d3 | |||
9c7d652fbb | |||
7855d78a64 | |||
cf6c452b1e | |||
acf6e6845c | |||
968d781b70 | |||
e9c9cb531d | |||
83cb131efe | |||
26a0688dae | |||
6807cd35ad | |||
877bce4d1a | |||
55f7b609b1 | |||
6089a46d63 | |||
70bcf69b1b | |||
fc108773d9 | |||
92a6ba2b64 | |||
57daf12ed4 | |||
cabcce03b3 | |||
a9c77c6614 | |||
1c84703ac6 | |||
25e1e5165d | |||
a76234f43d | |||
a3afadd5f5 | |||
002b3cf338 | |||
a7895ef59a | |||
852a096f1d | |||
69030796f5 | |||
19d92c8cac | |||
c792ea20ad | |||
611205e78f | |||
4be8bb72f4 | |||
76cb025606 | |||
aa84aa0539 | |||
04f43b95ff | |||
a1009b5293 | |||
91a05f882e | |||
74d270b6d2 | |||
200420c9b0 | |||
acf5cea593 | |||
307f03c7c0 | |||
32b4daf3fb | |||
55e88f7b45 | |||
8baef3b2b5 | |||
80baca45e5 | |||
75eac65510 | |||
44b8daa325 | |||
2cd2c7c02e | |||
33b1b6527c | |||
9e60264d7d | |||
c96b2393d3 | |||
5fa97ea82b | |||
74027d705d | |||
8dfc339194 | |||
f4545af4fe | |||
81737d5d3a |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/.vs
|
||||
/Zway-Bot/obj
|
||||
/Zway-Bot/bin
|
310
CHANGELOG.md
Normal file
310
CHANGELOG.md
Normal file
@ -0,0 +1,310 @@
|
||||
# Changelog
|
||||
|
||||
## 1.8.4 - 2022-01-30 - Logging now more better
|
||||
### New Features
|
||||
* Default settings.conf have now debug=false
|
||||
* ZwayDataUpdate now uses DebugLogging flag
|
||||
### Bugfixes
|
||||
* Fixing bug in logrotate-script
|
||||
### Changes
|
||||
* ProgrammLogger SetPath removed cause its done by Bot-Utils
|
||||
* IniReader SetSearchPath removed, cause its done by Bot-Utils
|
||||
*
|
||||
* Bump Bot-Utils to ([v.1.2.6](https://git.blubbfish.net/vs_utils/Bot-Utils/src/tag/v1.2.6))
|
||||
* Bump Utils to ([v.1.6.2](https://git.blubbfish.net/vs_utils/Utils/src/tag/v1.2.6))
|
||||
|
||||
## 1.8.3 - 2022-01-20 - Shutdown working
|
||||
### New Features
|
||||
* Deconstruction makes better Output
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* Bump Bot-Utils to ([v.1.2.5](https://git.blubbfish.net/vs_utils/Bot-Utils/src/tag/v1.2.5))
|
||||
* Bunp Utils to ([v1.6.1](https://git.blubbfish.net/vs_utils/Utils/src/tag/v1.6.1))
|
||||
* Bump Zway to ([v1.6.1](https://git.blubbfish.net/vs_projects/Zway/src/tag/v1.6.1))
|
||||
* Modify buildscript
|
||||
|
||||
## 1.8.2 - 2022-01-19 - Logging better
|
||||
### New Features
|
||||
* Change buildscript, so logrotate is not overwritten by setup every time
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* Change default logpath
|
||||
* Modify buildscript
|
||||
|
||||
## 1.8.1 - 2022-01-18 - New Default Configs
|
||||
### New Features
|
||||
* Bump Bot-Utils to ([v1.2.4](https://git.blubbfish.net/vs_utils/Bot-Utils/src/tag/v1.2.4)) and using the possibillity to enable via config if a module is loaded
|
||||
### Bugfixes
|
||||
* Buildscript not cleansup behind
|
||||
### Changes
|
||||
* New Sample Configs
|
||||
* Codingstyles
|
||||
* Add dependency to dotnet-runtime-3.1 (>= 3.1.22) in buildscript
|
||||
|
||||
## 1.8.0 - 2022-01-16 - Running again
|
||||
### New Features
|
||||
* Change licence file (LGPL 4)
|
||||
* Running in netcore now
|
||||
* Add Changelog, Contribution
|
||||
* Update Readme
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* Remove releases from source
|
||||
* Using the rewrote abstract mqtt class
|
||||
* Also senml is simpler
|
||||
* Loading of names.ini different so it now passes another datastructure
|
||||
* names.ini are now containing deviceid related items and not the same data for the same device
|
||||
* settings.ini now needs a type
|
||||
* Sample config not having example in name anymore
|
||||
* Buildsystem is now using ci-scripts
|
||||
* Windows installer using new location of icons
|
||||
|
||||
## 1.7.3 - 2018-10-29 - Change dependencys
|
||||
### New Features
|
||||
* Add readme
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* update mono-runtime dependency to 5.16
|
||||
* Move licence to another location
|
||||
|
||||
## 1.7.2 - 2018-10-02 - Improve
|
||||
### New Features
|
||||
* Add Logging to some Modules
|
||||
### Bugfixes
|
||||
* fixing a bug in overtaker (now it not removes every time all events, so only the latest event are watched)
|
||||
### Changes
|
||||
|
||||
## 1.7.1 - 2018-09-29 - Tiny fix for nullpointer exception
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* Fixing issue in zway lib ([v1.5.1](https://git.blubbfish.net/vs_projects/Zway/src/tag/v1.5.1))
|
||||
### Changes
|
||||
|
||||
## 1.7.0 - 2018-09-29 - Rewrite of Eventhandleing, Threaded
|
||||
### New Features
|
||||
* Rewrite of Eventhandleing, Threaded
|
||||
* enable service before reloading systemd
|
||||
* kill the process if its not stopping in 5s
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* Change the Namespace
|
||||
* Codestyle
|
||||
* Exceptionhandleing
|
||||
|
||||
## 1.6.2 - 2018-06-09 - Moved CronJob, Overtaker, Statuspolling to Abstract Bot-Utils
|
||||
### New Features
|
||||
* Add first Licence
|
||||
* Move more to Bot-Utils
|
||||
* Finish creation of windowssetup
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.6.1 - 2018-06-07 - Add Bot-Utils and rewrite code
|
||||
### New Features
|
||||
* Move Abstract Stuff to Bot-Utils
|
||||
* Rewrite to use the new Utils Library
|
||||
* Make Senml as a childclass of Mqtt
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.6.0 - 2018-06-05 - Thread that checks if a MQTT Connection exists and if not reopen it
|
||||
### New Features
|
||||
* Automatic reconnect in MQTT
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.5.7 - 2018-06-02 - new try
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* forget cr
|
||||
### Changes
|
||||
|
||||
## 1.5.6 - 2018-06-02 - new try
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* using /bin/bash
|
||||
### Changes
|
||||
|
||||
## 1.5.5 - 2018-06-02 - new try
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* restart not working correctly
|
||||
### Changes
|
||||
|
||||
## 1.5.4 - 2018-06-02 - Fixing Bug in after installation script
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* not using sudo in installscripts
|
||||
### Changes
|
||||
|
||||
## 1.5.3 - 2018-06-02 - Making service linux running
|
||||
### New Features
|
||||
* restart the service if its was running before
|
||||
* Output the error to syslog
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.5.2 - 2018-06-02 - Cleanup
|
||||
### New Features
|
||||
* Debian Package includes the arch in name
|
||||
### Bugfixes
|
||||
* Try to fix a shutdown bug
|
||||
### Changes
|
||||
* Move deb package to another dictionary
|
||||
* Codingstyle
|
||||
* Programm is not stared automatically after install
|
||||
* Remove the creation of logfile in service file
|
||||
|
||||
## 1.5.1 - 2018-06-02 - Logrotate
|
||||
### New Features
|
||||
* Output when creating the waiting loop
|
||||
* Add logrotate script to debian package
|
||||
### Bugfixes
|
||||
* Absolute paths in service file
|
||||
### Changes
|
||||
|
||||
## 1.5.0 - 2018-05-29 - More Systemd
|
||||
### New Features
|
||||
* Buildscript now dedects the versionnumber itselfs
|
||||
### Bugfixes
|
||||
* Mono.Runtime is only called when its presend
|
||||
* postinst reloads systemctl first before try to start service
|
||||
* Create the logfile first before start the programm
|
||||
### Changes
|
||||
* Remove the old starting system with screen
|
||||
|
||||
## 1.4.3 - 2018-05-15 - Now sould dedect Strg+c on Linux
|
||||
### New Features
|
||||
* Posibillity to dedect Interrupt on Linux also
|
||||
* Extend debian package to use postinst, where the service is started
|
||||
* preinst now creates a group
|
||||
### Bugfixes
|
||||
* Remove BOM on sample configs
|
||||
### Changes
|
||||
|
||||
## 1.4.2 - 2018-05-15 - Fixinig installations dpkg script
|
||||
### New Features
|
||||
* The arch is now an argument in build
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.4.1 - 2018-05-15 - Fixinig installations dpkg script
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* Using any instead of i386 arch
|
||||
### Changes
|
||||
|
||||
## 1.4.0 - 2018-05-15 - Utils.csproj
|
||||
### New Features
|
||||
* Using Programmlogger now
|
||||
* Extend debian package to use systemd
|
||||
* Add linux systemd service file
|
||||
### Bugfixes
|
||||
* Remove Starting / in mqtt topic
|
||||
### Changes
|
||||
* Waiting fot Interrupt for exit the program
|
||||
* Codingstyles
|
||||
|
||||
## 1.3.4 - 2018-05-12 - Bump zway lib to v1.4.3
|
||||
### New Features
|
||||
* Start of generating windows installer
|
||||
### Bugfixes
|
||||
* Fixing issue in zway lib ([v1.4.3](https://git.blubbfish.net/vs_projects/Zway/src/tag/v1.4.3))
|
||||
### Changes
|
||||
|
||||
## 1.3.3 - 2018-05-10 - Bump zway lib to v1.4.2.0
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* Fixing issue in zway lib ([v1.4.2.0](https://git.blubbfish.net/vs_projects/Zway/src/tag/v1.4.2.0))
|
||||
### Changes
|
||||
* Move the finish deb packets to another directory
|
||||
|
||||
## 1.3.2 - 2018-05-08 - Debian Packaging
|
||||
### New Features
|
||||
* Start creating debian packages
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.3.1.0 - 2018-05-07 - Add Senml
|
||||
### New Features
|
||||
* Add HasInterface to Helper
|
||||
* Add Senml Module
|
||||
* Add helper for Debian so the programm can be run as service like
|
||||
* Type /exit to shutdown the program
|
||||
* IniReader now supports the config lookup
|
||||
* Add Config examples
|
||||
### Bugfixes
|
||||
* Avoid nullpointer exception
|
||||
### Changes
|
||||
* Remove Flex4Grid Plugin
|
||||
* Make ABackend as a Parent Class of ADataBackend
|
||||
|
||||
## 1.3.0.0 - 2017-12-22 - add possability to modify the config over mqtt
|
||||
### New Features
|
||||
* Config is now stored in an array, so it can be modyfied
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* Mqtt Modul Refactored
|
||||
|
||||
## 1.2.2.0 - 2017-12-19 - Set values over mqtt
|
||||
### New Features
|
||||
* Helper has now ToUpperLower
|
||||
* Possiblity to Set and get values over mqtt
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.2.1.0 - 2017-12-17 - Tiny fix for mqtt
|
||||
### New Features
|
||||
* Helper can now dedect Double
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.2.0.0 - 2017-12-17 - Adding Status Polling and Mqtt (not compelete)
|
||||
### New Features
|
||||
* Add IForceLoad, so a module is loaded even if there is no config for it
|
||||
* Add Mqtt Module
|
||||
* Add StatusPolling, so All devices are regulary querdied (once a day)
|
||||
### Bugfixes
|
||||
### Changes
|
||||
* Refactoring
|
||||
|
||||
## 1.1.2.1 - 2017-12-09 - Next try to emulate F4G Events
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* Flex4Grid needs more hacking to emulate a client
|
||||
### Changes
|
||||
|
||||
## 1.1.2.0 - 2017-12-08 - Interconnection
|
||||
### New Features
|
||||
* Module can now access each other during load
|
||||
* Cronjob now can execure actions from other modules
|
||||
### Bugfixes
|
||||
* F4G needs to "ping" the server
|
||||
### Changes
|
||||
|
||||
## 1.1.1.0 - 2017-12-06 - F4G Module
|
||||
### New Features
|
||||
* Add Flex4Grid Module
|
||||
* Add Icon (“Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com.)
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.1.0.0 - 2017-12-02 - AModul
|
||||
### New Features
|
||||
* Internal eventing is now using ModulEventArgs
|
||||
* Add AModul, Refactoring Modules
|
||||
* Improving Modul Loading
|
||||
### Bugfixes
|
||||
### Changes
|
||||
|
||||
## 1.0.1.0 - 2017-12-01 - Cronjob Bugfix
|
||||
### New Features
|
||||
### Bugfixes
|
||||
* Fixing Bug with Cronjob
|
||||
### Changes
|
||||
|
||||
## 1.0.0.0 - 2017-11-25 - Init
|
||||
### New Features
|
||||
* First Version
|
||||
### Bugfixes
|
||||
### Changes
|
92
CONTRIBUTING.md
Normal file
92
CONTRIBUTING.md
Normal file
@ -0,0 +1,92 @@
|
||||
# Contributing
|
||||
|
||||
When contributing to this repository, please first discuss the change you wish to make via issue,
|
||||
email, or any other method with the owners of this repository before making a change.
|
||||
|
||||
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
||||
|
||||
## Pull Request Process
|
||||
|
||||
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
|
||||
build.
|
||||
2. Update the README.md with details of changes to the interface, this includes new environment
|
||||
variables, exposed ports, useful file locations and container parameters.
|
||||
3. Increase the version numbers in any examples files and the README.md to the new version that this
|
||||
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
|
||||
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
|
||||
do not have permission to do that, you may request the second reviewer to merge it for you.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
### Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
### Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
### Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
### Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
### Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at git ATTTT blubbfish.net. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
### Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
165
LICENSE
Normal file
165
LICENSE
Normal file
@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
54
README.md
Normal file
54
README.md
Normal file
@ -0,0 +1,54 @@
|
||||
# BlubbFish.IoT.Bots.ZwayBot (Zway-Bot)
|
||||
<!-- Short description of the project. -->
|
||||
|
||||
Programm that uses the zway library and crawls zwave data from a controller.
|
||||
|
||||
This program is running on every hardware that supports dotnet.
|
||||
|
||||
<!-- A teaser figure may be added here. It is best to keep the figure small (<500KB) and in the same repo -->
|
||||
|
||||
## Getting Started
|
||||
<!-- Instruction to make the project up and running. -->
|
||||
|
||||
The project documentation is available on the [Wiki](https://git.blubbfish.net/vs_projects/Zway-Bot/wiki).
|
||||
|
||||
## Usage
|
||||
<!-- Deployment/Installation instructions. If this is software library, change this section to "Usage" and give usage examples -->
|
||||
This software can not run itselfs, cause its a library.
|
||||
|
||||
## Development
|
||||
<!-- Developer instructions. -->
|
||||
* Versioning: Use [SemVer](http://semver.org/) and tag the repository with full version string. E.g. `v1.0.0`
|
||||
|
||||
### Copyright
|
||||
|
||||
This library is under GNU LESSER GENERAL PUBLIC LICENSE Version 3
|
||||
|
||||
### Prerequisite
|
||||
|
||||
If you want to work with this programm, please checkout [zway-project](https://git.blubbfish.net/vs/zway-project) with all submodules, to get all dependencies.
|
||||
|
||||
#### Internal
|
||||
* BlubbFish.Utils ([Utils](https://git.blubbfish.net/vs_utils/Utils))
|
||||
* BlubbFish.Utils.IoT ([Utils-IoT](https://git.blubbfish.net/vs_utils/Utils-IoT))
|
||||
* BlubbFish.Utils.IoT.Bots ([Bot-Utils](https://git.blubbfish.net/vs_utils/Bot-Utils))
|
||||
* BlubbFish.Utils.IoT.Interfaces ([Iot-Interfaces](https://git.blubbfish.net/vs_utils/Iot-Interfaces))
|
||||
* BlubbFish.Utils.IoT.Connector.Data ([ConnectorDataMqtt](https://git.blubbfish.net/vs_utils/ConnectorDataMqtt))
|
||||
* BlubbFish.IoT.Zway ([Zway](https://git.blubbfish.net/vs_projects/Zway))
|
||||
|
||||
#### External
|
||||
* M2Mqtt ([Used Fork](https://github.com/blubbfish/mqtt), [Original](https://github.com/eclipse/paho.mqtt.m2mqtt))
|
||||
* litjson ([Used Fork](https://github.com/blubbfish/litjson), [Original](https://github.com/LitJSON/litjson))
|
||||
|
||||
### Test
|
||||
|
||||
You need to compile he library and use it with a calling agent.
|
||||
|
||||
### Build
|
||||
|
||||
Build it with Visual Studio.
|
||||
|
||||
## Contributing
|
||||
Contributions are welcome.
|
||||
|
||||
Please fork, make your changes, and submit a pull request. For major changes, please open an issue first and discuss it with the other authors.
|
72
Zway-Bot.sln
72
Zway-Bot.sln
@ -1,13 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26730.16
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29806.167
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zway-Bot", "Zway-Bot\Zway-Bot.csproj", "{AEF8059F-8AEF-45C7-85C4-318C8F797900}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zway-Bot", "Zway-Bot\Zway-Bot.csproj", "{47EE9E42-FD75-4768-B87E-30CD98845742}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zway", "..\Zway\Zway\Zway.csproj", "{166258ED-CB3D-43F5-8E8D-3A993B64D022}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils", "..\Utils\Utils\Utils\Utils.csproj", "{DB0BD8C3-154C-4A72-9B17-BC043435559E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{554A9B22-98B3-4713-BE21-F76B21C5343F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Iot-Interfaces", "..\Utils\Iot-Interfaces\Iot-Interfaces\Iot-Interfaces.csproj", "{A84D05FC-A267-494F-BA6F-A1FBC165EF7F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectorDataMqtt", "..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt.csproj", "{AEEC3445-A3A4-498C-8729-9AB3DC692C58}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj", "{FCE6AD89-D55A-4B2B-9BBB-87BBC3DC7DFA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson", "..\Librarys\litjson\litjson\litjson.csproj", "{452E1239-789A-4FA0-A7B2-B546C792C80B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "M2Mqtt", "..\Librarys\mqtt\M2Mqtt\M2Mqtt.csproj", "{2D53CFD6-A412-4427-9461-E1CAF6815A63}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zway", "..\Zway\Zway\Zway.csproj", "{B25686A9-D5F1-4A87-B156-9B02444DFFF7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -15,23 +27,47 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AEF8059F-8AEF-45C7-85C4-318C8F797900}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AEF8059F-8AEF-45C7-85C4-318C8F797900}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AEF8059F-8AEF-45C7-85C4-318C8F797900}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AEF8059F-8AEF-45C7-85C4-318C8F797900}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{166258ED-CB3D-43F5-8E8D-3A993B64D022}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{166258ED-CB3D-43F5-8E8D-3A993B64D022}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{166258ED-CB3D-43F5-8E8D-3A993B64D022}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{166258ED-CB3D-43F5-8E8D-3A993B64D022}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{47EE9E42-FD75-4768-B87E-30CD98845742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{47EE9E42-FD75-4768-B87E-30CD98845742}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{47EE9E42-FD75-4768-B87E-30CD98845742}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{47EE9E42-FD75-4768-B87E-30CD98845742}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DB0BD8C3-154C-4A72-9B17-BC043435559E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DB0BD8C3-154C-4A72-9B17-BC043435559E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DB0BD8C3-154C-4A72-9B17-BC043435559E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DB0BD8C3-154C-4A72-9B17-BC043435559E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{554A9B22-98B3-4713-BE21-F76B21C5343F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{554A9B22-98B3-4713-BE21-F76B21C5343F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{554A9B22-98B3-4713-BE21-F76B21C5343F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{554A9B22-98B3-4713-BE21-F76B21C5343F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A84D05FC-A267-494F-BA6F-A1FBC165EF7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A84D05FC-A267-494F-BA6F-A1FBC165EF7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A84D05FC-A267-494F-BA6F-A1FBC165EF7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A84D05FC-A267-494F-BA6F-A1FBC165EF7F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AEEC3445-A3A4-498C-8729-9AB3DC692C58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AEEC3445-A3A4-498C-8729-9AB3DC692C58}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AEEC3445-A3A4-498C-8729-9AB3DC692C58}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AEEC3445-A3A4-498C-8729-9AB3DC692C58}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FCE6AD89-D55A-4B2B-9BBB-87BBC3DC7DFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FCE6AD89-D55A-4B2B-9BBB-87BBC3DC7DFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FCE6AD89-D55A-4B2B-9BBB-87BBC3DC7DFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FCE6AD89-D55A-4B2B-9BBB-87BBC3DC7DFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{452E1239-789A-4FA0-A7B2-B546C792C80B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{452E1239-789A-4FA0-A7B2-B546C792C80B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{452E1239-789A-4FA0-A7B2-B546C792C80B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{452E1239-789A-4FA0-A7B2-B546C792C80B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2D53CFD6-A412-4427-9461-E1CAF6815A63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2D53CFD6-A412-4427-9461-E1CAF6815A63}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2D53CFD6-A412-4427-9461-E1CAF6815A63}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2D53CFD6-A412-4427-9461-E1CAF6815A63}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B25686A9-D5F1-4A87-B156-9B02444DFFF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B25686A9-D5F1-4A87-B156-9B02444DFFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B25686A9-D5F1-4A87-B156-9B02444DFFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B25686A9-D5F1-4A87-B156-9B02444DFFF7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FC298685-EC11-4957-9D91-F044DDDD0B6E}
|
||||
SolutionGuid = {BD3495D8-45C6-495E-81C9-EA9C711C6B75}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,37 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace ZwayBot {
|
||||
public class CronEvent : ModulEventArgs {
|
||||
|
||||
public CronEvent() {
|
||||
}
|
||||
|
||||
public CronEvent(String addr, String prop, String value) {
|
||||
this.Address = addr;
|
||||
this.Property = prop;
|
||||
this.Value = value;
|
||||
this.Source = "Cronjob";
|
||||
}
|
||||
}
|
||||
public class OvertakerEvent : ModulEventArgs {
|
||||
|
||||
public OvertakerEvent() {
|
||||
}
|
||||
|
||||
public OvertakerEvent(String addr, String prop, String value) {
|
||||
this.Address = addr;
|
||||
this.Property = prop;
|
||||
this.Value = value;
|
||||
this.Source = "Overtaker";
|
||||
}
|
||||
}
|
||||
|
||||
public class ModulEventArgs : EventArgs {
|
||||
public ModulEventArgs() {
|
||||
}
|
||||
public String Address { get; protected set; }
|
||||
public String Property { get; protected set; }
|
||||
public String Value { get; protected set; }
|
||||
public String Source { get; protected set; }
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ZwayBot {
|
||||
class Helper {
|
||||
public static void SetProperty(Object o, String name, String value) {
|
||||
PropertyInfo prop = o.GetType().GetProperty(name);
|
||||
if (prop.CanWrite) {
|
||||
if (prop.PropertyType == typeof(Boolean) && Boolean.TryParse(value, out Boolean vb)) {
|
||||
prop.SetValue(o, vb);
|
||||
} else if (prop.PropertyType == typeof(Int32) && Int32.TryParse(value, out Int32 v32)) {
|
||||
prop.SetValue(o, v32);
|
||||
} else if (prop.PropertyType == typeof(Single) && Single.TryParse(value, out Single vs)) {
|
||||
prop.SetValue(o, vs);
|
||||
} else if (prop.PropertyType == typeof(Int64) && Int64.TryParse(value, out Int64 v64)) {
|
||||
prop.SetValue(o, v64);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static Boolean HasProperty(Object o, String type) {
|
||||
Type t = o.GetType();
|
||||
foreach (PropertyInfo item in t.GetProperties()) {
|
||||
if (item.Name == type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static Object GetProperty(Object o, String name) {
|
||||
PropertyInfo prop = o.GetType().GetProperty(name);
|
||||
if(prop.CanRead) {
|
||||
return prop.GetValue(o);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static Boolean HasInterface(Object o, String type) {
|
||||
Type t = o.GetType();
|
||||
foreach (Type item in t.GetInterfaces()) {
|
||||
if(item.Name == type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static void WriteError(String text) {
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.Error.WriteLine("ERROR: " + text);
|
||||
Console.ResetColor();
|
||||
}
|
||||
}
|
||||
}
|
BIN
Zway-Bot/Icon.ico
Normal file
BIN
Zway-Bot/Icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using BlubbFish.IoT.Zway;
|
||||
using BlubbFish.Utils;
|
||||
|
||||
namespace ZwayBot {
|
||||
abstract class AModul {
|
||||
protected ZwayController zw;
|
||||
protected InIReader ini;
|
||||
|
||||
public AModul(ZwayController zway, InIReader settings) {
|
||||
this.zw = zway;
|
||||
this.ini = settings;
|
||||
}
|
||||
|
||||
public delegate void ModulEvent(Object sender, ModulEventArgs e);
|
||||
public abstract event ModulEvent Update;
|
||||
|
||||
public abstract void Dispose();
|
||||
}
|
||||
}
|
@ -1,185 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
|
||||
using BlubbFish.IoT.Zway;
|
||||
using BlubbFish.IoT.Zway.Interfaces;
|
||||
using BlubbFish.Utils;
|
||||
using BlubbFish.Utils.IoT.Bots.Events;
|
||||
using BlubbFish.Utils.IoT.Bots.Moduls;
|
||||
|
||||
namespace ZwayBot.Moduls {
|
||||
internal class CronJob : AModul, IDisposable {
|
||||
private DateTime crontime;
|
||||
private Thread thread;
|
||||
|
||||
namespace BlubbFish.IoT.Bots.ZwayBot.Moduls {
|
||||
internal class CronJob : CronJob<ZwayController> {
|
||||
public override event ModulEvent Update;
|
||||
|
||||
private Dictionary<String, String> cron_named = new Dictionary<String, String> {
|
||||
{ "@yearly", "0 0 1 1 *" },
|
||||
{ "@annually", "0 0 1 1 *" },
|
||||
{ "@monthly", "0 0 1 * *" },
|
||||
{ "@weekly", "0 0 * * 0" },
|
||||
{ "@daily", "0 0 * * *" },
|
||||
{ "@hourly", "0 * * * *" }
|
||||
};
|
||||
public CronJob(ZwayController zway, InIReader settings) : base(zway, settings) { }
|
||||
|
||||
public CronJob(ZwayController zway, InIReader settings) : base(zway, settings) {
|
||||
this.crontime = DateTime.Now;
|
||||
this.thread = new Thread(this.Runner);
|
||||
this.thread.Start();
|
||||
}
|
||||
|
||||
private void Runner() {
|
||||
Thread.Sleep(DateTime.Now.AddMinutes(1).AddSeconds(DateTime.Now.Second * (-1)).AddMilliseconds(DateTime.Now.Millisecond * (-1)) - DateTime.Now);
|
||||
while (true) {
|
||||
if(this.crontime.Minute != DateTime.Now.Minute) {
|
||||
this.crontime = DateTime.Now;
|
||||
foreach (String item in this.ini.GetSections()) {
|
||||
if(ParseCronString(this.ini.GetValue(item, "cron"))) {
|
||||
this.SetValues(this.ini.GetValue(item, "set"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetValues(String value) {
|
||||
protected override void SetValues(String value) {
|
||||
foreach (String item in value.Split(';')) {
|
||||
String[] items = item.Split(':');
|
||||
if(items.Length == 2) {
|
||||
String[] addr = items[0].Split('-');
|
||||
String[] values = items[1].Split('-');
|
||||
if(addr.Length == 3 || addr.Length == 4) {
|
||||
Int32 deviceid = Int32.Parse(addr[0]);
|
||||
Int32 instanceid = Int32.Parse(addr[1]);
|
||||
Int32 classid = Int32.Parse(addr[2]);
|
||||
ICommandClass c;
|
||||
if(addr.Length == 4) {
|
||||
Int32 subcid = Int32.Parse(addr[3]);
|
||||
c = this.zw.GetCommandClassSub(deviceid, instanceid, classid, subcid);
|
||||
} else {
|
||||
c = this.zw.GetCommandClass(deviceid, instanceid, classid);
|
||||
}
|
||||
if (c != null && values.Length == 2) {
|
||||
if (Helper.HasProperty(c, values[0])) {
|
||||
Helper.SetProperty(c, values[0], values[1]);
|
||||
this.Update?.Invoke(this, new CronEvent(items[0], values[0], values[1]));
|
||||
}
|
||||
ACommandClass c = this.library.GetCommandClass(items[0]);
|
||||
if (c != null && values.Length == 2) {
|
||||
if (c.HasProperty(values[0])) {
|
||||
c.SetProperty(values[0], values[1]);
|
||||
this.Update?.Invoke(this, new CronEvent(items[0], values[0], values[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean ParseCronString(String str) {
|
||||
str = str.Trim();
|
||||
if(this.cron_named.ContainsKey(str)) {
|
||||
str = this.cron_named[str];
|
||||
}
|
||||
String[] value = str.Split(' ');
|
||||
if(value.Length != 5) {
|
||||
return false;
|
||||
}
|
||||
if (!this.CheckDateStr(this.crontime.ToString("mm"), value[0], "0-59")) {
|
||||
return false;
|
||||
}
|
||||
if (!this.CheckDateStr(this.crontime.ToString("HH"), value[1], "0-23")) {
|
||||
return false;
|
||||
}
|
||||
if (!this.CheckDateStr(this.crontime.ToString("MM"), value[3], "1-12")) {
|
||||
return false;
|
||||
}
|
||||
if (value[2] != "*" && value[4] != "*") {
|
||||
if (!this.CheckDateStr(this.crontime.ToString("dd"), value[2], "1-31") && !this.CheckDateStr(((Int32)this.crontime.DayOfWeek).ToString(), value[4], "0-7")) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!this.CheckDateStr(this.crontime.ToString("dd"), value[2], "1-31")) {
|
||||
return false;
|
||||
}
|
||||
if (!this.CheckDateStr(((Int32)this.crontime.DayOfWeek).ToString(), value[4], "0-7")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public override void EventLibSetter() { }
|
||||
|
||||
private Boolean CheckDateStr(String date, String cron, String limit) {
|
||||
cron = cron.ToLower();
|
||||
for (Int32 i = 0; i <= 6; i++) {
|
||||
cron = cron.Replace(DateTime.Parse("2015-01-" + (4 + i) + "T00:00:00").ToString("ddd", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
|
||||
cron = cron.Replace(DateTime.Parse("2015-01-" + (4 + i) + "T00:00:00").ToString("dddd", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
|
||||
}
|
||||
for (Int32 i = 1; i <= 12; i++) {
|
||||
cron = cron.Replace(DateTime.Parse("2015-"+i+"-01T00:00:00").ToString("MMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
|
||||
cron = cron.Replace(DateTime.Parse("2015-" + i + "-01T00:00:00").ToString("MMMM", CultureInfo.CreateSpecificCulture("en-US")), i.ToString());
|
||||
}
|
||||
if (cron.Contains("*")) {
|
||||
cron = cron.Replace("*", limit);
|
||||
}
|
||||
if(cron.Contains("-")) {
|
||||
MatchCollection m = new Regex("(\\d+)-(\\d+)").Matches(cron);
|
||||
foreach (Match p in m) {
|
||||
List<String> s = new List<String>();
|
||||
for(Int32 i=Math.Min(Int32.Parse(p.Groups[1].Value), Int32.Parse(p.Groups[2].Value));i<= Math.Max(Int32.Parse(p.Groups[1].Value), Int32.Parse(p.Groups[2].Value)); i++) {
|
||||
s.Add(i.ToString());
|
||||
}
|
||||
cron = cron.Replace(p.Groups[0].Value, String.Join(",", s));
|
||||
}
|
||||
}
|
||||
Int32 match = 0;
|
||||
if(cron.Contains("/")) {
|
||||
Match m = new Regex("/(\\d+)").Match(cron);
|
||||
cron = cron.Replace(m.Groups[0].Value, "");
|
||||
match = Int32.Parse(m.Groups[1].Value);
|
||||
}
|
||||
Dictionary<Int32, String> ret = new Dictionary<Int32, String>();
|
||||
if(!cron.Contains(",")) {
|
||||
ret.Add(Int32.Parse(cron), "");
|
||||
} else {
|
||||
foreach (String item in cron.Split(',')) {
|
||||
if(!ret.ContainsKey(Int32.Parse(item))) {
|
||||
ret.Add(Int32.Parse(item), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(match != 0) {
|
||||
Dictionary<Int32, String> r = new Dictionary<Int32, String>();
|
||||
foreach (KeyValuePair<Int32, String> item in ret) {
|
||||
if(item.Key%match == 0) {
|
||||
r.Add(item.Key, "");
|
||||
}
|
||||
}
|
||||
ret = r;
|
||||
}
|
||||
return ret.ContainsKey(Int32.Parse(date));
|
||||
}
|
||||
|
||||
#region IDisposable Support
|
||||
private Boolean disposedValue = false;
|
||||
|
||||
protected virtual void Dispose(Boolean disposing) {
|
||||
if (!this.disposedValue) {
|
||||
if (disposing) {
|
||||
this.thread.Abort();
|
||||
while(this.thread.ThreadState != ThreadState.Aborted) { Thread.Sleep(100); }
|
||||
}
|
||||
|
||||
this.thread = null;
|
||||
|
||||
this.disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
~CronJob() {
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
#endregion
|
||||
protected override void LibUpadteThread(Object state) { }
|
||||
}
|
||||
}
|
84
Zway-Bot/Moduls/Mqtt.cs
Normal file
84
Zway-Bot/Moduls/Mqtt.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using BlubbFish.IoT.Zway;
|
||||
using BlubbFish.IoT.Zway.Events;
|
||||
using BlubbFish.IoT.Zway.Interfaces;
|
||||
using BlubbFish.Utils;
|
||||
using BlubbFish.Utils.IoT.Bots.Events;
|
||||
using BlubbFish.Utils.IoT.Bots.Moduls;
|
||||
using BlubbFish.Utils.IoT.Connector;
|
||||
using BlubbFish.Utils.IoT.Events;
|
||||
using BlubbFish.Utils.IoT.Interfaces;
|
||||
|
||||
using LitJson;
|
||||
|
||||
namespace BlubbFish.IoT.Bots.ZwayBot.Moduls {
|
||||
class Mqtt : Mqtt<ZwayController> {
|
||||
public override event ModulEvent Update;
|
||||
|
||||
public Mqtt(ZwayController lib, InIReader settings) : base(lib, settings) { }
|
||||
|
||||
|
||||
public override void EventLibSetter() => this.library.Recieved += this.HandleLibUpdate;
|
||||
|
||||
|
||||
protected override void LibUpadteThread(Object state) {
|
||||
try {
|
||||
if(this.mqtt.IsConnected) {
|
||||
DeviceUpdateEvent e = state as DeviceUpdateEvent;
|
||||
if(e.Parent.GetType().HasInterface(typeof(IMqtt))) {
|
||||
IMqtt sensor = e.Parent as IMqtt;
|
||||
((ADataBackend)this.mqtt).Send("zwavebot/devices/" + sensor.MqttTopic(), sensor.ToJson());
|
||||
this.Update?.Invoke(this, new MqttEvent("zwavebot/devices/" + sensor.MqttTopic(), sensor.ToJson()));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Helper.WriteError("BlubbFish.IoT.Bots.ZwayBot.Moduls.Mqtt.LibUpadteThread: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
protected virtual void MqttUpdate(Object sender, BackendEvent e) {
|
||||
try {
|
||||
if (this.mqtt.IsConnected) {
|
||||
if (e.From.ToString().StartsWith("zwavebot/devices/") && (e.From.ToString().EndsWith("/set") || e.From.ToString().EndsWith("/get"))) {
|
||||
Match m = new Regex("^zwavebot/devices/(\\d+)/(\\d+)/(\\d+)/[gs]et$|^zwavebot/devices/(\\d+)/(\\d+)/(\\d+)/(\\d+)/[gs]et$").Match(e.From.ToString());
|
||||
String id = "";
|
||||
if (m.Groups[1].Success) {
|
||||
id = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value;
|
||||
}
|
||||
if (m.Groups[4].Success) {
|
||||
id = m.Groups[4].Value + "-" + m.Groups[5].Value + "-" + m.Groups[6].Value + "-" + m.Groups[7].Value;
|
||||
}
|
||||
ACommandClass c = this.library.GetCommandClass(id);
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
if (e.From.ToString().EndsWith("/set")) {
|
||||
try {
|
||||
JsonData a = JsonMapper.ToObject(e.Message);
|
||||
foreach (String item in a.Keys) {
|
||||
String key = item.ToUpperLower();
|
||||
if (c.HasProperty(key)) {
|
||||
c.SetProperty(key, a[item].ToString());
|
||||
this.Update?.Invoke(this, new MqttEvent(c.Id, a[item].ToString()));
|
||||
}
|
||||
}
|
||||
} catch (Exception) { }
|
||||
} else if (e.From.ToString().EndsWith("/get")) {
|
||||
c.PollOnce = true;
|
||||
((ADataBackend)this.mqtt).Send("zwavebot/devices/" + c.MqttTopic(), c.ToJson());
|
||||
this.Update?.Invoke(this, new MqttEvent(e.From.ToString(), "Dataget"));
|
||||
}
|
||||
}
|
||||
Tuple<Boolean, MqttEvent> cs = this.ChangeConfig(e, "zwavebot/config/");
|
||||
if (cs.Item1) {
|
||||
this.Update?.Invoke(this, cs.Item2);
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,122 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BlubbFish.IoT.Zway;
|
||||
using BlubbFish.IoT.Zway.Events;
|
||||
using BlubbFish.IoT.Zway.Interfaces;
|
||||
using BlubbFish.Utils;
|
||||
using BlubbFish.Utils.IoT.Bots.Events;
|
||||
using BlubbFish.Utils.IoT.Bots.Moduls;
|
||||
|
||||
namespace ZwayBot.Moduls {
|
||||
internal class Overtaker : AModul, IDisposable {
|
||||
private Dictionary<String, Dictionary<String, String>> events = new Dictionary<String, Dictionary<String, String>>();
|
||||
|
||||
namespace BlubbFish.IoT.Bots.ZwayBot.Moduls {
|
||||
internal class Overtaker : Overtaker<ZwayController> {
|
||||
private readonly Dictionary<String, ACommandClass> overtakeritems = new Dictionary<String, ACommandClass>();
|
||||
public override event ModulEvent Update;
|
||||
|
||||
public Overtaker(ZwayController zway, InIReader settings) : base(zway, settings) {
|
||||
this.ParseIni();
|
||||
|
||||
public Overtaker(ZwayController zway, InIReader settings) : base(zway, settings) { }
|
||||
|
||||
protected override void AddLibraryUpdateHook(String id) {
|
||||
ACommandClass c = this.library.GetCommandClass(id);
|
||||
if (c != null) {
|
||||
Console.WriteLine("BlubbFish.IoT.Bots.ZwayBot.Moduls.Overtaker.LibraryUpdateHook: Add Watcher to " + c.Name + " [" + c.Id + "]");
|
||||
this.overtakeritems.Add(id, c);
|
||||
c.Polling = true;
|
||||
c.Update += this.HandleLibUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseIni() {
|
||||
foreach (String item in this.ini.GetSections()) {
|
||||
String from = this.ini.GetValue(item, "from");
|
||||
String[] source = from.Split(':');
|
||||
this.events.Add(source[0], this.ini.GetSection(item));
|
||||
String[] addr = source[0].Split('-');
|
||||
ICommandClass c;
|
||||
if (addr.Length == 3 || addr.Length == 4) {
|
||||
Int32 deviceid = Int32.Parse(addr[0]);
|
||||
Int32 instanceid = Int32.Parse(addr[1]);
|
||||
Int32 classid = Int32.Parse(addr[2]);
|
||||
if (addr.Length == 4) {
|
||||
Int32 subcid = Int32.Parse(addr[3]);
|
||||
c = this.zw.GetCommandClassSub(deviceid, instanceid, classid, subcid);
|
||||
} else {
|
||||
c = this.zw.GetCommandClass(deviceid, instanceid, classid);
|
||||
protected override void RemoveLibraryUpdateHooks() {
|
||||
foreach (KeyValuePair<String, ACommandClass> item in this.overtakeritems) {
|
||||
Console.WriteLine("BlubbFish.IoT.Bots.ZwayBot.Moduls.Overtaker.LibraryUpdateHook: Remove Watcher to " + item.Value.Name + " [" + item.Value.Id + "]");
|
||||
item.Value.Polling = false;
|
||||
item.Value.Update -= this.HandleLibUpdate;
|
||||
}
|
||||
this.overtakeritems.Clear();
|
||||
}
|
||||
|
||||
protected override void LibUpadteThread(Object state) {
|
||||
try {
|
||||
DeviceUpdateEvent e = state as DeviceUpdateEvent;
|
||||
if (e.Parent.GetType().HasAbstract(typeof(ACommandClass))) {
|
||||
if (this.events.ContainsKey(((ACommandClass)e.Parent).Id)) {
|
||||
this.SetValues(e.Parent, ((ACommandClass)e.Parent).Id, this.events[((ACommandClass)e.Parent).Id]);
|
||||
}
|
||||
if (c != null) {
|
||||
c.Polling = true;
|
||||
c.Update += this.ChangedEvent;
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
|
||||
protected override void SetValueHook(String id, String prop, String value) {
|
||||
ACommandClass c = this.library.GetCommandClass(id);
|
||||
if (c != null) {
|
||||
if (c.HasProperty(prop)) {
|
||||
if (c.GetProperty(prop).ToString() != value) {
|
||||
c.SetProperty(prop, value);
|
||||
this.Update?.Invoke(this, new OvertakerEvent(id, prop, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangedEvent(Object sender, DeviceUpdateEvent e) {
|
||||
if(Helper.HasInterface(sender, "ICommandClass")) {
|
||||
if (this.events.ContainsKey(((ICommandClass)sender).Id)) {
|
||||
this.SetValues(sender, ((ICommandClass)sender).Id, this.events[((ICommandClass)sender).Id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetValues(Object sender, String name, Dictionary<String, String> dictionary) {
|
||||
String from = dictionary["from"];
|
||||
String[] source = from.Split(':');
|
||||
if (source.Length != 2) {
|
||||
return;
|
||||
}
|
||||
String source_value;
|
||||
if (Helper.HasProperty(sender, source[1])) {
|
||||
source_value = Helper.GetProperty(sender, source[1]).ToString();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if(dictionary.ContainsKey("convert")) {
|
||||
foreach (String tuple in dictionary["convert"].Split(';')) {
|
||||
String[] item = tuple.Split('-');
|
||||
if(source_value == item[0]) {
|
||||
source_value = item[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (String to in dictionary["to"].Split(';')) {
|
||||
String[] target = to.Split(':');
|
||||
if(target.Length == 2) {
|
||||
String[] addr = target[0].Split('-');
|
||||
if (addr.Length == 3 || addr.Length == 4) {
|
||||
Int32 deviceid = Int32.Parse(addr[0]);
|
||||
Int32 instanceid = Int32.Parse(addr[1]);
|
||||
Int32 classid = Int32.Parse(addr[2]);
|
||||
ICommandClass c;
|
||||
if (addr.Length == 4) {
|
||||
Int32 subcid = Int32.Parse(addr[3]);
|
||||
c = this.zw.GetCommandClassSub(deviceid, instanceid, classid, subcid);
|
||||
} else {
|
||||
c = this.zw.GetCommandClass(deviceid, instanceid, classid);
|
||||
}
|
||||
if (c != null) {
|
||||
String target_value;
|
||||
if (Helper.HasProperty(c, target[1])) {
|
||||
target_value = Helper.GetProperty(c, target[1]).ToString();
|
||||
if (target_value != source_value) {
|
||||
Helper.SetProperty(c, target[1], source_value);
|
||||
this.Update?.Invoke(this, new OvertakerEvent(target[0], target[1], source_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region IDisposable Support
|
||||
private Boolean disposedValue = false;
|
||||
|
||||
protected virtual void Dispose(Boolean disposing) {
|
||||
if (!this.disposedValue) {
|
||||
if (disposing) {
|
||||
}
|
||||
this.disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
~Overtaker() {
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
#endregion
|
||||
public override void EventLibSetter() { }
|
||||
}
|
||||
}
|
41
Zway-Bot/Moduls/Senml.cs
Normal file
41
Zway-Bot/Moduls/Senml.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
|
||||
using BlubbFish.IoT.Zway;
|
||||
using BlubbFish.IoT.Zway.Events;
|
||||
using BlubbFish.Utils;
|
||||
using BlubbFish.Utils.IoT.Bots.Events;
|
||||
using BlubbFish.Utils.IoT.Connector;
|
||||
using BlubbFish.Utils.IoT.Events;
|
||||
using BlubbFish.Utils.IoT.Interfaces;
|
||||
|
||||
namespace BlubbFish.IoT.Bots.ZwayBot.Moduls {
|
||||
class Senml : Mqtt {
|
||||
public override event ModulEvent Update;
|
||||
private readonly String SenmlGuid;
|
||||
|
||||
public Senml(ZwayController zway, InIReader settings) : base(zway, settings) {
|
||||
if (this.config.ContainsKey("settings")) {
|
||||
this.SenmlGuid = this.config["settings"]["guid"];
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
protected override void LibUpadteThread(Object state) {
|
||||
try {
|
||||
if(this.mqtt.IsConnected) {
|
||||
DeviceUpdateEvent e = state as DeviceUpdateEvent;
|
||||
if(e.Parent.GetType().HasInterface(typeof(ISenml))) {
|
||||
ISenml sensor = e.Parent as ISenml;
|
||||
((ADataBackend)this.mqtt).Send(sensor.SenmlTopic() + this.SenmlGuid + "/senml", sensor.ToSenml());
|
||||
this.Update?.Invoke(this, new MqttEvent(sensor.SenmlTopic() + this.SenmlGuid + "/senml", sensor.ToSenml()));
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Helper.WriteError("BlubbFish.IoT.Bots.ZwayBot.Moduls.Mqtt.LibUpadteThread: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void MqttUpdate(Object sender, BackendEvent e) { }
|
||||
#endregion
|
||||
}
|
||||
}
|
46
Zway-Bot/Moduls/StatusPolling.cs
Normal file
46
Zway-Bot/Moduls/StatusPolling.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BlubbFish.IoT.Zway;
|
||||
using BlubbFish.IoT.Zway.Devices;
|
||||
using BlubbFish.IoT.Zway.Interfaces;
|
||||
using BlubbFish.Utils;
|
||||
using BlubbFish.Utils.IoT.Bots.Events;
|
||||
using BlubbFish.Utils.IoT.Bots.Moduls;
|
||||
|
||||
namespace BlubbFish.IoT.Bots.ZwayBot.Moduls {
|
||||
class Statuspolling : Statuspolling<ZwayController> {
|
||||
public override event ModulEvent Update;
|
||||
|
||||
public Statuspolling(ZwayController zway, InIReader settings) : base(zway, settings) { }
|
||||
|
||||
protected override void PollSpecific(Object obj) {
|
||||
String devices = (String)obj;
|
||||
foreach (String item in devices.Split(',')) {
|
||||
ACommandClass c = this.library.GetCommandClass(item);
|
||||
c.PollOnce = true;
|
||||
this.Update?.Invoke(this, new StatusPollingEvent("Polling", item));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PollAll(Object obj) {
|
||||
foreach (KeyValuePair<Int32, Device> device in this.library.Devices) {
|
||||
foreach (KeyValuePair<Int32, Instance> instance in device.Value.Instances) {
|
||||
foreach (KeyValuePair<ACommandClass.Classes, ACommandClass> commandclass in instance.Value.CommandClasses) {
|
||||
commandclass.Value.PollOnce = true;
|
||||
if(commandclass.Value.HasSub) {
|
||||
foreach (KeyValuePair<Int32, ACommandClass> subclass in commandclass.Value.Sub) {
|
||||
subclass.Value.PollOnce = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.Update?.Invoke(this, new StatusPollingEvent("Polling", "all nodes"));
|
||||
}
|
||||
|
||||
public override void EventLibSetter() { }
|
||||
|
||||
protected override void LibUpadteThread(Object state) { }
|
||||
}
|
||||
}
|
@ -1,83 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using BlubbFish.IoT.Zway;
|
||||
using BlubbFish.Utils;
|
||||
using ZwayBot.Moduls;
|
||||
using BlubbFish.Utils.IoT.Bots;
|
||||
|
||||
namespace ZwayBot {
|
||||
class Program {
|
||||
namespace BlubbFish.IoT.Bots.ZwayBot {
|
||||
class Program : Bot<ZwayController> {
|
||||
static void Main(String[] args) => new Program(args);
|
||||
|
||||
private ZwayController zw;
|
||||
private Dictionary<String, AModul> moduls = new Dictionary<String, AModul>();
|
||||
public Program(String[] args) : base(args, true, "zwaybot") {
|
||||
Console.WriteLine("BlubbFish.IoT.Bots.ZwayBot.Program.Constructor()");
|
||||
|
||||
public Program(String[] args) {
|
||||
Dictionary<String, String> names;
|
||||
if(File.Exists("names.ini")) {
|
||||
names = InIReader.GetInstance("names.ini").GetSection("names");
|
||||
} else {
|
||||
names = new Dictionary<String, String>();
|
||||
Dictionary<String, ReadOnlyDictionary<String, String>> names = new Dictionary<String, ReadOnlyDictionary<String, String>>();
|
||||
if(InIReader.ConfigExist("names")) {
|
||||
foreach(String item in InIReader.GetInstance("names").GetSections(false)) {
|
||||
names.Add(item, new ReadOnlyDictionary<String, String>( InIReader.GetInstance("names").GetSection(item)));
|
||||
}
|
||||
}
|
||||
if(!File.Exists("settings.ini")) {
|
||||
if(!InIReader.ConfigExist("settings")) {
|
||||
Helper.WriteError("No settings.ini found. Abord!");
|
||||
return;
|
||||
}
|
||||
this.zw = new ZwayController(InIReader.GetInstance("settings.ini").GetSection("zway"), names, false);
|
||||
this.zw.Update += this.ZwayDataUpate;
|
||||
this.ModulLoader();
|
||||
|
||||
ZwayController zw = new ZwayController(InIReader.GetInstance("settings").GetSection("zway"), names, false);
|
||||
zw.Recieved += this.ZwayDataUpate;
|
||||
|
||||
this.ModulLoader("BlubbFish.IoT.Bots.ZwayBot.Moduls", zw);
|
||||
this.ModulInterconnect();
|
||||
this.ModulEvents();
|
||||
this.WaitForShutdown();
|
||||
this.Deconstructor(zw);
|
||||
|
||||
Console.WriteLine("Bye!");
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
private void Deconstructor(ZwayController zw) {
|
||||
Console.WriteLine("BlubbFish.IoT.Bots.ZwayBot.Program.Deconstructor(): Deconstruct ZwayBot.");
|
||||
|
||||
this.ModulDispose();
|
||||
Console.WriteLine("BlubbFish.IoT.Bots.ZwayBot.Program.Deconstructor(): ModuleDisposed.");
|
||||
|
||||
zw.Dispose();
|
||||
Console.WriteLine("BlubbFish.IoT.Bots.ZwayBot.Program.Deconstructor(): Zway lib Disposed.");
|
||||
}
|
||||
|
||||
private void WaitForShutdown() {
|
||||
while (true) {
|
||||
System.Threading.Thread.Sleep(100);
|
||||
if (Console.KeyAvailable) {
|
||||
ConsoleKeyInfo key = Console.ReadKey(false);
|
||||
if (key.Key == ConsoleKey.Escape) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void ZwayDataUpate(Object sender, Zway.Events.DeviceUpdateEvent e) {
|
||||
if(this.DebugLogging) {
|
||||
Console.WriteLine("-> ZW [" + e.UpdateTime + "]: " + e.Parent.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void ModulDispose() {
|
||||
foreach (KeyValuePair<String, AModul> item in this.moduls) {
|
||||
item.Value.Dispose();
|
||||
Console.WriteLine("Modul entladen: " + item.Key);
|
||||
}
|
||||
this.zw.Dispose();
|
||||
}
|
||||
|
||||
private void ModulEvents() {
|
||||
foreach (KeyValuePair<String, AModul> item in this.moduls) {
|
||||
item.Value.Update += this.ModulUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
private void ModulUpdate(Object sender, ModulEventArgs e) {
|
||||
Console.WriteLine(e.Source+": " + e.Address + " set " + e.Property + " to " + e.Value);
|
||||
}
|
||||
|
||||
private void ModulLoader() {
|
||||
Assembly asm = Assembly.GetExecutingAssembly();
|
||||
foreach (Type item in asm.GetTypes()) {
|
||||
if(item.Namespace == "ZwayBot.Moduls") {
|
||||
Type t = item;
|
||||
String name = t.Name;
|
||||
if (File.Exists(name.ToLower() + ".ini")) {
|
||||
this.moduls.Add(name, (AModul)t.GetConstructor(new Type[] { typeof(ZwayController), typeof(InIReader) }).Invoke(new Object[] { this.zw, InIReader.GetInstance(name.ToLower() + ".ini") }));
|
||||
Console.WriteLine("Load Modul " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ZwayDataUpate(Object sender, BlubbFish.IoT.Zway.Events.DeviceUpdateEvent e) {
|
||||
Console.WriteLine("-> ZW [" + e.UpdateTime + "]: " + sender.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
[assembly: AssemblyTitle("Zway-Bot")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Zway-Bot")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
|
||||
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("aef8059f-8aef-45c7-85c4-318c8f797900")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
1
Zway-Bot/Resources/icon.svg
Normal file
1
Zway-Bot/Resources/icon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg width='200' height='200' fill="#000000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><path d="M21,57.9v-6.5c0-2.9,2.4-5.3,5.3-5.3H41v-6.1c0-1.1,0.9-2,2-2s2,0.9,2,2v14.7c0,0.7,0.6,1.3,1.3,1.3h15.8c1.1,0,2,0.9,2,2 s-0.9,2-2,2H46.3c-2.9,0-5.3-2.4-5.3-5.3V50H26.3c-0.7,0-1.3,0.6-1.3,1.3v6.5c0,1.1-0.9,2-2,2S21,59,21,57.9z M79.8,72.9 c-1.1,0-2,0.9-2,2v1.7c0,0.7-0.6,1.3-1.3,1.3H62.2c-0.7,0-1.3-0.6-1.3-1.3c0-3.1-3.3-5.7-6.1-5.7H42.3c-1.1,0-2,0.9-2,2s0.9,2,2,2 h12.5c0.9,0,2.1,1.1,2.1,1.7c0,2.9,2.4,5.3,5.3,5.3h14.3c2.9,0,5.3-2.4,5.3-5.3v-1.7C81.8,73.8,80.9,72.9,79.8,72.9z M36,70.1 C36,70.1,36,70.1,36,70.1l0,14.4c0,0.8-0.4,1.4-1.1,1.8l-11,5.5c-0.1,0-0.2,0.1-0.2,0.1c-0.1,0-0.1,0-0.2,0.1C23.3,92,23.2,92,23,92 c0,0,0,0,0,0c-0.2,0-0.3,0-0.5-0.1c-0.1,0-0.1,0-0.2-0.1c-0.1,0-0.2,0-0.2-0.1l-11-5.5c-0.7-0.3-1.1-1-1.1-1.8V70.2c0,0,0-0.1,0-0.1 c0-0.1,0-0.2,0-0.3c0,0,0-0.1,0-0.1c0.1-0.3,0.2-0.6,0.4-0.8c0,0,0.1-0.1,0.1-0.1c0.1-0.1,0.2-0.2,0.3-0.2c0,0,0,0,0.1-0.1 c0,0,0,0,0.1,0c0,0,0.1,0,0.1-0.1l11-5.5c0.6-0.3,1.2-0.3,1.8,0l11,5.5c0,0,0.1,0,0.1,0.1c0,0,0,0,0.1,0c0,0,0,0,0.1,0.1 c0.1,0.1,0.2,0.1,0.3,0.2c0,0,0.1,0.1,0.1,0.1c0.2,0.2,0.4,0.5,0.4,0.8c0,0,0,0.1,0,0.1C36,69.9,36,70,36,70.1z M16.4,70.2l6.6,3.3 l6.6-3.3L23,66.9L16.4,70.2z M21,76.9l-7-3.5v9.8l7,3.5V76.9z M32,73.4l-7,3.5v9.8l7-3.5V73.4z M90.3,57.5c0,6.2-5.1,11.3-11.3,11.3 s-11.3-5.1-11.3-11.3S72.8,46.2,79,46.2S90.3,51.3,90.3,57.5z M86.3,57.5c0-4-3.3-7.3-7.3-7.3s-7.3,3.3-7.3,7.3s3.3,7.3,7.3,7.3 S86.3,61.5,86.3,57.5z M29.1,26.5c-0.1-0.6,0-1.2,0.3-1.6l12-17.1c0-0.1,0.1-0.1,0.2-0.2c0.1-0.1,0.1-0.1,0.2-0.2 C42,7.1,42.5,6.9,43,6.9c0,0,0,0,0,0s0,0,0,0c0,0,0,0,0,0c0,0,0,0,0,0s0,0,0,0c0.5,0,1,0.2,1.3,0.5c0.1,0.1,0.1,0.1,0.2,0.2 c0.1,0.1,0.1,0.1,0.2,0.2l12,17.1c0.3,0.5,0.4,1.1,0.3,1.6c-0.1,0.6-0.5,1-1,1.3l-12,6c-0.1,0-0.1,0.1-0.2,0.1 c-0.1,0-0.2,0.1-0.3,0.1C43.3,34,43.2,34,43,34c-0.3,0-0.6-0.1-0.8-0.2c0,0,0,0,0,0c0,0-0.1,0-0.1,0l-12-6 C29.6,27.5,29.2,27.1,29.1,26.5z M45,28.8l7-3.5l-7-10V28.8z M34,25.2l7,3.5V15.2L34,25.2z M78.2,51.6c-2.5,0.3-4.5,2.1-4.9,4.6 c-0.2,1.1,0.5,2.1,1.6,2.3c0.1,0,0.2,0,0.4,0c0.9,0,1.8-0.7,2-1.6c0.1-0.7,0.7-1.3,1.4-1.3c1.1-0.1,1.9-1.1,1.8-2.2 C80.3,52.3,79.2,51.5,78.2,51.6z M92.9,34.5c-3.8-3.8-8.8-5.8-14.1-5.8s-10.3,2.1-14.1,5.8c-0.8,0.8-0.8,2,0,2.8 c0.8,0.8,2,0.8,2.8,0c3-3,7-4.7,11.3-4.7s8.3,1.7,11.3,4.7c0.4,0.4,0.9,0.6,1.4,0.6s1-0.2,1.4-0.6C93.7,36.5,93.7,35.3,92.9,34.5z M73.1,42.8c1.5-1.5,3.6-2.4,5.8-2.4c2.2,0,4.2,0.8,5.8,2.4c0.4,0.4,0.9,0.6,1.4,0.6s1-0.2,1.4-0.6c0.8-0.8,0.8-2,0-2.8 c-2.3-2.3-5.3-3.6-8.6-3.6c-3.2,0-6.3,1.3-8.6,3.6c-0.8,0.8-0.8,2,0,2.8C71,43.6,72.3,43.6,73.1,42.8z"/></svg>
|
After Width: | Height: | Size: 2.7 KiB |
@ -1,67 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AEF8059F-8AEF-45C7-85C4-318C8F797900}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>ZwayBot</RootNamespace>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>BlubbFish.IoT.Bots.ZwayBot.Program</RootNamespace>
|
||||
<AssemblyName>Zway-Bot</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>ZwayBot.Program</StartupObject>
|
||||
<PackageId>Program.ZwayBot.Bots.IoT.BlubbFish</PackageId>
|
||||
<Version>1.8.4</Version>
|
||||
<NeutralLanguage>de-DE</NeutralLanguage>
|
||||
<Description>Is a Bot for Zwave Devices</Description>
|
||||
<Authors>BlubbFish</Authors>
|
||||
<Company>BlubbFish</Company>
|
||||
<Copyright>Copyright © BlubbFish 2017 - 30.01.2022</Copyright>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageProjectUrl>https://git.blubbfish.net/vs_projects/Zway-Bot</PackageProjectUrl>
|
||||
<RepositoryUrl>https://git.blubbfish.net/vs_projects/Zway-Bot.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageReleaseNotes>
|
||||
1.8.4 - 2022-01-30 - Logging now more better
|
||||
1.8.3 - 2022-01-20 - Shutdown working
|
||||
1.8.2 - 2022-01-19 - Logging better
|
||||
1.8.1 - 2022-01-18 - New Default Configs
|
||||
1.8.0 - 2022-01-16 - Running again
|
||||
1.7.3 - 2018-10-29 - Change dependencys
|
||||
1.7.2 - 2018-10-02 - Improve
|
||||
1.7.1 - 2018-09-29 - Tiny fix for nullpointer exception
|
||||
1.7.0 - 2018-09-29 - Rewrite of Eventhandleing, Threaded
|
||||
1.6.2 - 2018-06-09 - Moved CronJob, Overtaker, Statuspolling to Abstract Bot-Utils
|
||||
1.6.1 - 2018-06-07 - Add Bot-Utils and rewrite code
|
||||
1.6.0 - 2018-06-05 - Thread that checks if a MQTT Connection exists and if not reopen it
|
||||
1.5.7 - 2018-06-02 - new try
|
||||
1.5.6 - 2018-06-02 - new try
|
||||
1.5.5 - 2018-06-02 - new try
|
||||
1.5.4 - 2018-06-02 - Fixing Bug in after installation script
|
||||
1.5.3 - 2018-06-02 - Making service linux running
|
||||
1.5.2 - 2018-06-02 - Cleanup
|
||||
1.5.1 - 2018-06-02 - Logrotate
|
||||
1.5.0 - 2018-05-29 - More Systemd
|
||||
1.4.3 - 2018-05-15 - Now sould dedect Strg+c on Linux
|
||||
1.4.2 - 2018-05-15 - Fixinig installations dpkg script
|
||||
1.4.1 - 2018-05-15 - Fixinig installations dpkg script
|
||||
1.4.0 - 2018-05-15 - Utils.csproj
|
||||
1.3.4 - 2018-05-12 - Bump zway lib to v1.4.3
|
||||
1.3.3 - 2018-05-10 - Bump zway lib to v1.4.2.0
|
||||
1.3.2 - 2018-05-08 - Debian Packaging
|
||||
1.3.1.0 - 2018-05-07 - Add Senml
|
||||
1.3.0.0 - 2017-12-22 - add possability to modify the config over mqtt
|
||||
1.2.2.0 - 2017-12-19 - Set values over mqtt
|
||||
1.2.1.0 - 2017-12-17 - Tiny fix for mqtt
|
||||
1.2.0.0 - 2017-12-17 - Adding Status Polling and Mqtt (not compelete)
|
||||
1.1.2.1 - 2017-12-09 - Next try to emulate F4G Events
|
||||
1.1.2.0 - 2017-12-08 - Interconnection
|
||||
1.1.1.0 - 2017-12-06 - F4G Module
|
||||
1.1.0.0 - 2017-12-02 - AModul
|
||||
1.0.1.0 - 2017-12-01 - Cronjob Bugfix
|
||||
1.0.0.0 - 2017-11-25 - Init
|
||||
</PackageReleaseNotes>
|
||||
<PackageIconUrl />
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Content Include="../CHANGELOG.md" />
|
||||
<Content Include="../CONTRIBUTING.md" />
|
||||
<Content Include="../LICENSE" />
|
||||
<Content Include="../README.md" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Events.cs" />
|
||||
<Compile Include="Moduls\AModul.cs" />
|
||||
<Compile Include="Moduls\CronJob.cs" />
|
||||
<Compile Include="Helper.cs" />
|
||||
<Compile Include="Moduls\Overtaker.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<None Include="..\LICENSE">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
</None>
|
||||
<None Include="Resources\Icon.ico">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath></PackagePath>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
|
||||
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
|
||||
<Name>Utils</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Zway\Zway\Zway.csproj">
|
||||
<Project>{166258ed-cb3d-43f5-8e8d-3a993b64d022}</Project>
|
||||
<Name>Zway</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj" />
|
||||
<ProjectReference Include="..\..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt.csproj" />
|
||||
<ProjectReference Include="..\..\Utils\Iot-Interfaces\Iot-Interfaces\Iot-Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\Utils\Utils-IoT\Utils-IoT\Utils-IoT.csproj" />
|
||||
<ProjectReference Include="..\..\Utils\Utils\Utils\Utils.csproj" />
|
||||
<ProjectReference Include="..\..\Zway\Zway\Zway.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="config-example\cronjob.conf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config-example\mqtt.conf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config-example\names.conf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config-example\overtaker.conf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config-example\senml.conf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config-example\settings.conf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="config-example\statuspolling.conf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11
Zway-Bot/config-example/cronjob.conf
Normal file
11
Zway-Bot/config-example/cronjob.conf
Normal file
@ -0,0 +1,11 @@
|
||||
[modul]
|
||||
enabled=true
|
||||
config=public
|
||||
|
||||
; [cold]
|
||||
; cron=0 23 * * 0-4
|
||||
; set=7-0-67-2:Level-19;7-0-112-8:Level-2
|
||||
|
||||
; [hot]
|
||||
; cron=0 16 * * 1-5
|
||||
; set=7-0-67-1:Level-22;7-0-112-8:Level-1
|
7
Zway-Bot/config-example/mqtt.conf
Normal file
7
Zway-Bot/config-example/mqtt.conf
Normal file
@ -0,0 +1,7 @@
|
||||
[modul]
|
||||
enabled=false
|
||||
config=private
|
||||
|
||||
[settings]
|
||||
type=mqtt
|
||||
server=localhost
|
86
Zway-Bot/config-example/names.conf
Normal file
86
Zway-Bot/config-example/names.conf
Normal file
@ -0,0 +1,86 @@
|
||||
[2-3-32784]
|
||||
0=Default
|
||||
0-49-1=Temperatur
|
||||
0-67-1=Einstellung Heizen Ziel
|
||||
0-67-2=Einstellung Kühlen Ziel
|
||||
0-67-10=Einstellung Automatisch Ziel
|
||||
0-91=Taster
|
||||
0-112-1=Config (Temperaturgrenzwert für Bericht)
|
||||
0-112-2=Config (Temperaturwert setzen)
|
||||
0-112-3=Config (Minimum Temperaturwert setzen)
|
||||
0-112-4=Config (Maximum Temperaturwert setzen)
|
||||
0-112-5=Config (LED Flash Periode)
|
||||
0-112-6=Config (Kontrollfunktion setzen)
|
||||
0-112-7=Config (Temporärer Überbrückungsplan)
|
||||
0-112-8=Config (Temperaturregelung setzen)
|
||||
0-112-9=Config (LED on time)
|
||||
0-112-10=Config (Dauer des LED Blinkens)
|
||||
0-112-11=Config (LED Farbe)
|
||||
0-128=Batterie
|
||||
0-132=Wakeup
|
||||
0-135=Indikator
|
||||
|
||||
[271-1536-4096]
|
||||
0=Default
|
||||
0-37=Schalter
|
||||
0-49-4=Leistung
|
||||
0-50-0=Verbrauch [kWh]
|
||||
0-50-2=Verbrauch [W]
|
||||
0-112-1=Config (Immer AN)
|
||||
0-112-16=Config (Zurück zu altem Status nach Stromausfall)
|
||||
0-112-34=Config (Reaktion auf Alarm)
|
||||
0-112-35=Config (Antwort auf Alarmmeldung)
|
||||
0-112-39=Config (Alarm Dauer)
|
||||
0-112-40=Config (Sofortiger Bericht über Stromverbrauch)
|
||||
0-112-42=Config (Änderung der Leistung zum Generieren eines Reports)
|
||||
0-112-43=Config (Regelmäßiges Senden eines Reports über die Stromaufnahme)
|
||||
0-112-45=Config (Automatisches Senden eines Reportes über Stromverbrauch bei Verbrauchsänderung)
|
||||
0-112-47=Config (Zeitinterval zum Senden eines Reportes ohne Änderung im Verbrauch)
|
||||
0-112-49=Config (Messen des Eigenstromverbrauches)
|
||||
0-112-50=Config (unterer Leistungsschwellwert)
|
||||
0-112-51=Config (oberer Leistungsschwellwert)
|
||||
0-112-52=Config (Aktion bei Erreichen des definierten Schwellwertes (Parameter 50/51))
|
||||
0-112-60=Config (Leistungsschwellwert für violettes Blinken)
|
||||
0-112-61=Config (LED Ring Farbe im Einschaltzustand)
|
||||
0-112-62=Config (LED Ring Farbe im Ausschaltzustand)
|
||||
0-112-63=Config (LED Ring Farbe bei Z-Wave Alarmmeldungen)
|
||||
0-112-70=Config (Überlastabschaltung)
|
||||
|
||||
[271-1538-4097]
|
||||
0=Default
|
||||
0-37=Schalter
|
||||
0-49-4=Leistung
|
||||
0-50-0=Verbrauch [kWh]
|
||||
0-50-2=Verbrauch [W]
|
||||
0-112-1=Config (Immer AN)
|
||||
0-112-2=Config (Zurück zu altem Status nach Stromausfall)
|
||||
0-112-3=Config (Überlastabschaltung)
|
||||
0-112-10=Config (Sofortiger Bericht über Stromverbrauch)
|
||||
0-112-11=Config (Änderung der Leistung zum Generieren eines Reports)
|
||||
0-112-12=Config (Regelmäßiges Senden eines Reports über die Stromaufnahme)
|
||||
0-112-13=Config (Automatisches Senden eines Reportes über Stromverbrauch bei Verbrauchsänderung)
|
||||
0-112-14=Config (Zeitinterval zum Senden eines Reportes ohne Änderung im Verbrauch)
|
||||
0-112-15=Config (Messen des Eigenstromverbrauches)
|
||||
0-112-20=Config (Assoziierte Geräte mitschalten invertieren)
|
||||
0-112-21=Config (unterer Leistungsschwellwert)
|
||||
0-112-22=Config (oberer Leistungsschwellwert)
|
||||
0-112-23=Config (Aktion bei Erreichen des definierten Schwellwertes (Parameter 21/22))
|
||||
0-112-24=Config (Assoziierte Geräte mitschalten)
|
||||
0-112-30=Config (Reaktion auf Alarm)
|
||||
0-112-31=Config (Antwort auf Alarmmeldung)
|
||||
0-112-32=Config (Alarm Dauer)
|
||||
0-112-40=Config (Leistungsschwellwert für violettes Blinken)
|
||||
0-112-41=Config (LED Ring Farbe im Einschaltzustand)
|
||||
0-112-42=Config (LED Ring Farbe im Ausschaltzustand)
|
||||
0-112-43=Config (LED Ring Farbe bei Z-Wave Alarmmeldungen)
|
||||
0-112-50=Config (Assozierte Geräte im sicheren Modus ansprechen)
|
||||
0-113=Alarmmeldung Leistungsschwellwert
|
||||
|
||||
[328-2-1]
|
||||
0-38=Reglerstellung
|
||||
0-49-1=Temperatur
|
||||
0-64=Thermostat Modus
|
||||
0-67-1=Einstellung Heizen
|
||||
0-67-11=Einstellung Kühlen
|
||||
0-128=Batterie
|
||||
0-132=Wakeup
|
16
Zway-Bot/config-example/overtaker.conf
Normal file
16
Zway-Bot/config-example/overtaker.conf
Normal file
@ -0,0 +1,16 @@
|
||||
[modul]
|
||||
enabled=false
|
||||
config=public
|
||||
|
||||
; [hot]
|
||||
; from=7-0-67-1:Level
|
||||
; to=8-0-67-1:Level;9-0-67-1:Level
|
||||
|
||||
; [cold]
|
||||
; from=7-0-67-2:Level
|
||||
; to=8-0-67-11:Level;9-0-67-11:Level
|
||||
|
||||
; [mode]
|
||||
; from=7-0-112-8:Level
|
||||
; to=8-0-64:Level;9-0-64:Level
|
||||
; convert=1-1;2-11
|
8
Zway-Bot/config-example/senml.conf
Normal file
8
Zway-Bot/config-example/senml.conf
Normal file
@ -0,0 +1,8 @@
|
||||
[modul]
|
||||
enabled=false
|
||||
config=private
|
||||
|
||||
[settings]
|
||||
type=mqtt
|
||||
server=localhost
|
||||
guid=linksmart-zwaybot
|
9
Zway-Bot/config-example/settings.conf
Normal file
9
Zway-Bot/config-example/settings.conf
Normal file
@ -0,0 +1,9 @@
|
||||
[zway]
|
||||
server=localhost
|
||||
user=admin
|
||||
pass=pass
|
||||
type=zway
|
||||
|
||||
[logging]
|
||||
path=/var/log/zwaybot/debug.log
|
||||
debug=false
|
7
Zway-Bot/config-example/statuspolling.conf
Normal file
7
Zway-Bot/config-example/statuspolling.conf
Normal file
@ -0,0 +1,7 @@
|
||||
[modul]
|
||||
enabled=true
|
||||
config=public
|
||||
|
||||
; [temp]
|
||||
; cron=30 * * * *
|
||||
; devices=7-0-49-1,8-0-49-1,9-0-49-1,10-0-49-1,11-0-49-1
|
3
Zway-Bot/dpkg/create-Builds.bat
Normal file
3
Zway-Bot/dpkg/create-Builds.bat
Normal file
@ -0,0 +1,3 @@
|
||||
bash.exe -c "./make-deb.sh"
|
||||
bash.exe -c "./make-exe.sh"
|
||||
pause
|
44
Zway-Bot/dpkg/make-deb.sh
Normal file
44
Zway-Bot/dpkg/make-deb.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
CSPROJFILE="Zway-Bot.csproj"
|
||||
VMAJOR=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 1)
|
||||
VMINOR=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 2)
|
||||
VBUILD=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 3)
|
||||
|
||||
mkdir -p ../deb
|
||||
mkdir -p ../Builds
|
||||
|
||||
export NAME=zwaybot
|
||||
export MAINAINER="BlubbFish <dev@blubbfish.net>"
|
||||
export VERSION="$VMAJOR.$VMINOR-$VBUILD"
|
||||
export DESCRIPTION="Zway-Bot manage a Zwave.me installation so that it has more features"
|
||||
export DEPENDENCIES="dotnet-runtime-3.1 (>= 3.1.22)"
|
||||
|
||||
export EXEPATH=Zway-Bot.dll
|
||||
export USERNAMEGROUP=zwaybot
|
||||
export EXEARGUMENTS=" "
|
||||
export RUNNER=/usr/share/dotnet/dotnet
|
||||
export COPYEXEC="../bin/Release/netcoreapp3.1/*.dll ../bin/Release/netcoreapp3.1/Zway-Bot.deps.json ../bin/Release/netcoreapp3.1/Zway-Bot.runtimeconfig.json"
|
||||
export LOGFILE="/var/log/zwaybot/debug.log"
|
||||
|
||||
export COPYCONFIG="../bin/Release/netcoreapp3.1/config-example/*.conf"
|
||||
export CONFIGREPLACEASK="cronjob.conf mqtt.conf names.conf overtaker.conf senml.conf settings.conf statuspolling.conf"
|
||||
|
||||
cd ../deb
|
||||
export PLATFORM=armhf
|
||||
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/control-build.sh | bash
|
||||
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/logrotate-build.sh | bash
|
||||
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/pre-post-build.sh | bash
|
||||
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/service-build.sh | bash
|
||||
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/build-deb.sh | bash
|
||||
|
||||
|
||||
export PLATFORM=amd64
|
||||
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/control-build.sh | bash
|
||||
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/build-deb.sh | bash
|
||||
|
||||
cd ..
|
||||
rm deb -rf
|
||||
|
||||
cp Builds/* ../../Builds/
|
||||
rm Builds -rf
|
96
Zway-Bot/dpkg/make-exe.nsi
Normal file
96
Zway-Bot/dpkg/make-exe.nsi
Normal file
@ -0,0 +1,96 @@
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
!include "MUI2.nsh"
|
||||
;--------------------------------
|
||||
;General
|
||||
Name "Zway-Bot x.x.x"
|
||||
OutFile "Zway-Bot x.x.x.exe"
|
||||
|
||||
InstallDir "$LOCALAPPDATA\Zway-Bot"
|
||||
InstallDirRegKey HKCU "Software\Zway-Bot" ""
|
||||
RequestExecutionLevel user
|
||||
ShowInstDetails show
|
||||
ShowUninstDetails show
|
||||
SetCompressor lzma
|
||||
SetDateSave off
|
||||
VIAddVersionKey "ProductName" "Zway-Bot"
|
||||
VIAddVersionKey "CompanyName" "BlubbFish"
|
||||
VIAddVersionKey "LegalTrademarks" "BlubbFish"
|
||||
VIProductVersion x.x.x
|
||||
;--------------------------------
|
||||
;Variables
|
||||
Var StartMenuFolder
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Zway-Bot"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
||||
!define MUI_ICON "..\Icon.ico"
|
||||
!define MUI_UNICON "..\Icon.ico"
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
|
||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Zway-Bot"
|
||||
;--------------------------------
|
||||
;Pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
;--------------------------------
|
||||
;Languages
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
InstType /NOCUSTOM
|
||||
InstType Vollständig
|
||||
InstType Minimal
|
||||
Section "!Programm" SecProg
|
||||
SectionIn 1 2
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Zway-Bot.lnk" "$INSTDIR\Zway-Bot.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
WriteRegStr HKCU "Software\Zway-Bot" "" $INSTDIR
|
||||
SetOutPath "$INSTDIR"
|
||||
File /r /x ..\bin\Release\netcoreapp3.1\Zway-Bot.deps.json ..\bin\Release\netcoreapp3.1\Zway-Bot.runtimeconfig.json
|
||||
File /r ..\bin\Release\netcoreapp3.1\*.dll
|
||||
File /r ..\bin\Release\netcoreapp3.1\*.exe
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
SectionEnd
|
||||
Section "Konfigurationsdateien" SecConf
|
||||
SectionIn 1
|
||||
CreateDirectory "$APPDATA\zwaybot"
|
||||
SetOutPath "$APPDATA\zwaybot"
|
||||
File /r ..\bin\Release\netcoreapp3.1\config-example\*.conf
|
||||
SectionEnd
|
||||
Section "Uninstall"
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
Delete "$INSTDIR\*.exe"
|
||||
Delete "$INSTDIR\*.dll"
|
||||
Delete "$INSTDIR\*.json"
|
||||
Delete "$APPDATA\zwaybot\*.conf"
|
||||
RMDir "$INSTDIR"
|
||||
RMDir "$APPDATA\zwaybot"
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
|
||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||
DeleteRegKey /ifempty HKCU "Software\Zway-Bot"
|
||||
SectionEnd
|
||||
;--------------------------------
|
||||
;Descriptions
|
||||
LangString DESC_SecProg ${LANG_GERMAN} "Das Zway-Bot Programm"
|
||||
LangString DESC_SecConf ${LANG_GERMAN} "Beispiel Konfigurationsdateien"
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecProg} $(DESC_SecProg)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Secconf} $(DESC_SecConf)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
;--------------------------------
|
15
Zway-Bot/dpkg/make-exe.sh
Normal file
15
Zway-Bot/dpkg/make-exe.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
CSPROJFILE="Zway-Bot.csproj"
|
||||
VMAJOR=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 1)
|
||||
VMINOR=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 2)
|
||||
VBUILD=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 3)
|
||||
|
||||
cp make-exe.nsi make.nsi
|
||||
sed -i s/Name\ \"Zway-Bot\ x\.x\.x\"/"Name \"Zway-Bot $VMAJOR.$VMINOR.$VBUILD\""/ make.nsi
|
||||
sed -i s/OutFile\ \"Zway-Bot\ x\.x\.x\.exe\"/"OutFile \"Zway-Bot $VMAJOR.$VMINOR.$VBUILD.exe\""/ make.nsi
|
||||
sed -i s/VIProductVersion\ x\.x\.x/"VIProductVersion $VMAJOR.$VMINOR.$VBUILD.0"/ make.nsi
|
||||
|
||||
makensis make.nsi
|
||||
rm make.nsi
|
||||
mv "Zway-Bot $VMAJOR.$VMINOR.$VBUILD.exe" ../../../Builds/"Zway-Bot $VMAJOR.$VMINOR.$VBUILD.exe"
|
Loading…
Reference in New Issue
Block a user