yfaway / openhab-rules Goto Github PK
View Code? Open in Web Editor NEWOpenHab rules for my home
OpenHab rules for my home
Use case: casting music to Google devices. When the periodic mindfulness bell is played, the casted music can't be resumed (but MP3 URI will be able to).
Add UI dropdown list containing options 15', 30', 1hr, 2hr, 3hr. The mindfulness bell will be paused for the associated amount of time.
Migrate all alert rules to Python.
2020-10-12 22:15:22.162 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'mqttConnections.things', using it anyway:
Provide a thing type ID and a thing ID in this format:
Provide a thing type ID and a thing ID in this format:
Provide a thing type ID and a thing ID in this format:
Provide a thing type ID and a thing ID in this format:
Provide a thing type ID and a thing ID in this format:
The current WiFi devices (garage opener and smart plugs) use 2.4 GHz band, which isn't very stable on the current router. They could go offline without being noticed. When that happens, the solution is to restart the router.
Scope: monitor these devices similar to battery-powered devices, and send an email if they aren't active recently.
This is an experimental features.
Optional: experimental options
experimental:
Optional: MQTT output type: json, attribute or json_and_attribute (default: shown below)
Examples when 'state' of a device is published
json: topic: 'zigbee2mqtt/my_bulb' payload '{"state": "ON"}'
attribute: topic 'zigbee2mqtt/my_bulb/state' payload 'ON"
json_and_attribute: both json and attribute (see above)
output: 'json'
See https://community.openhab.org/t/zigbee2mqtt-revisited-no-more-ugly-transformations/86362.
Today, to add an action to a zone, one has to do something like this:
zone.addAction(action, [ZoneEvent.MOTION, ...]
However, an action already know which events it handles. As such the API can be simplified to:
zone.addAction(action)
.
Each action needs to expose a new method getEvents() : list.
Current the zone's Action::onAction is invoked with between 3 and 4 parameters. As new requirement is introduced, more params are added. But that causes change in the method signature and require update to many actions.
Scope: move these params into a wrapper object EventInfo. That will allow adding more info to an event without having to change all existing actions.
Critical alert is currently handled by playing a loud TTS (event at sleep time) and sending an email.
Need to enhance this further to repeat the TTS couple of times, and to turn on all lights if it is evening time.
Have 3 sections:
People might not be interested in the implementation, but they might be interested in operation concepts/examples.
The doc hasn't been updated for a while. Lots of changes have happened in the API area.
For WiFi based devices that communicate with OpenHab via MQTT, if there is something wrong with the device, the UI still display the last values. This is misleading. Need to have a watch dog process that reset the values.
Other rules such as vacation mode or simulation of day time presence might have turned on light or play music. We would want to turn off all those when the system is disarmed.
Since the AlertManager already relies on the ZoneManager to determine the ActivityTimes (to adjust the audio alert volume), it makes sense to hold the alert user/admin email address in a virtual device. A rule can create the virtual device by reading the email addresses from config file and inject it into one of the zone.
The current rule doesn't work anymore duet o a name convention change between the OpenHab items.
Will replace this with a zone action.
Depends on #7 .
Besides removing the dependency, this will allow adjusting the timeout value dynamically if needed.
Instead of sending email alert to everyone in a household. Certain events only make sense to send to the admin of the house. This helps to reduce noises to regular user.
Add method AlertManager::processAdminAlert(alert)
Purpose: avoid breaking in during day time when thief thinks no one at home
Require: motion sensor at porch area, presence sensor (or security system), and audio device inside the house.
Play loud music when exterior motion sensor is triggered and if the house is armed.
Address a technical debt. The old devices are currently in aaa_modules/layout_model. They should be in aaa_modules/layout_model/devices.
Currently the zone exposes isOccupied() method, and the implementation is done by looking at a few known devices to determine the last usage time. This is not scalable and requiring hardcoding the device types.
A better approach is to add an abstract method Device::isOccupied() or Device::indicateOccupancy(). The Zone class can then just loop through the devices without the need to know their types.
The original implementation of alert_manager has to be a singleton with a bunch of static methods due to the inability to make an instance available in the script context.
This is now possible. Scope:
Currently the zone relies on Device::getItemName() to determine whether an item belongs to the zone. However, a device might be backed by multiple OH items. It is necessary to create a method such as Device::containsItem(itemName).
And use it as an occupancy sensor.
In production code the scope.events is used to deliver command to an item (that is backed by an actual binding). This is an asynchronous action. In the unit testing, to test if the state has been changed correctly, an artificial delay has to be inserted to wait for the event to be processed by the binding. This increases the duration of the test, and is also not reliable. Depends on the load of the system, it might takes longer to process the event.
Scope:
Can do the followings:
Will be backed by the Chromcast binding. List of functions:
If the user turns on a switch immediately after it was turned off, that indicates that the user would like to keep the switch on a bit longer. Also the zone doesn't have any other device that would extend the switch's timer.
As such, the switch needs to set the timer to a longer period than usual. Say 2.x times.
Configurable threshold in hours.
Limit to battery devices only.
Send alert once a day if devices haven't communicated after the threshold.
Add new API in Device class: isBatteryPowered(), setBatteryPowered(). Device classes must continue to be immutable.
This is useful when the device needs to performs a self-initiated action (e.g. from a timer), but it wants the action to be conditional to the zone's state (via other devices in the zone).
Aggregate all unit tests, run nightly and send an admin alert if there is an error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.