This repository contains example code making it possible to define things Schedule
type within openHAB framework.
Notice type of the Channel (below "Weekly schedule") and event in console with formatted text and non-core type.
Bill of materials:
-
api - the
TypeAndStateParser
interface interfered from openHAB CoreTypeParser
utility class. -
core - replacement of openHAB core which allows handling of new types. It swaps original
TypeParser
toDefaultTypeParser
with version backed byTypeParserDelegate
. additionally it solves troubles withItemEventFactory
cause it rely on hardcoded types. -
schedule - binding utilizing (and providing) custom types:
ListType
- a variable length container structurePairType
- tuple of two types, a pairTimeType
- basic time of the day structure representing aLocalTime
ScheduleType
- list of 7 lists with time-command pairs representing 7 days and commands to be executed at given this time.
The schedule module brings couple of more elements:
Above are necessary to actually provide necessary inputs for framework. There is not yet DTO and mapping, yet it does not blow up entire system.
This code was mostly developed in late 2018 without a major discussion behind. It was working with Eclipse SmartHome and been ported now (January 2020) to also work with openhab-core.
Build this code and then install api
module in runtime.
install file:/home/splatch/projects/openhab-schedule/api/target/api-0.10.0-SNAPSHOT.jar
Then determine openhab core bundle id:
openhab> la -s|grep org.openhab.core
133 x Active x 80 x 2.5.0 x org.openhab.core
and replace it with provisioned core
,
update 133 file:/home/splatch/projects/openhab-schedule/core/target/core-0.10.0-SNAPSHOT.jar
Finally install schedule
type and sample binding:
install file:/home/splatch/projects/openhab-schedule/schedule/target/schedule-0.10.0-SNAPSHOT.jar
This is an experiment, not intended for production use. Code which was copied is brought for research purposes.
The license of the code is a mixture of - Eclipse Public License v2 and "don't try it at home". You do it at your own risk.
Łukasz Dywicki / ConnectorIO