Appliances Implementations

Lights

light.presence.Appliance

class home.appliance.light.presence.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A light automatically turned off when no one is supposed to be using it. Because, as an example, the alarm system is armed.

This light model reacts to the following events:

  • home.appliance.light.event.forced.Event: tells the system a user turned on/off the light.

    • home.appliance.light.event.forced.Event.On -> the user turned on the light; the system moves the light model from off state to forced on state.

    • home.appliance.light.event.forced.Event.Off -> the user turned off the light; the system moves the light model from forced on state to off state since the off state is the default state.

  • home.event.presence.Event: tells the system someone could/could not being using the light

    • home.event.presence.Event.On -> the system will do nothing.

    • home.event.presence.Event.Off -> the system will un-force a forced on light because nobody is supposed to be using the light.

Final states:

  • Forced on

  • Off

Default state is Off.

>>> import home
>>> p = home.appliance.light.presence.Appliance("an indoor presence light", [])
>>> _, new = p.notify(home.appliance.light.event.forced.Event.On)
>>> new.compute()
'Forced On'
>>> _, new = p.notify(home.event.presence.Event.Off)
>>> new.compute()
'Off'
>>> _, new = p.notify(home.event.presence.Event.On)
>>> new.compute()
'Off'

light.zone.Appliance

class home.appliance.light.zone.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A light automatically turned on when someone is arriving in the light zone or is already there and the sun brightness is low.

Automatically turned off when no one is in the light zone, near it or the sun brightness is high, unless it was forced on by the user.

If the alarm system is armed and someone is coming the light becomes alarmed on and could start blinking.

This light model reacts to the following events:

  • home.appliance.light.event.forced.Event: tells the system a user turned on/off the light.

    • home.appliance.light.event.forced.Event.On -> the user turned on the light; the system moves the light model from off state to forced on state if the model is not already in the on state.

    • home.appliance.light.event.forced.Event.Off -> the user turned off the light; the system moves the light model from forced on state to off state since the off state is the default state unless was the system to turn on the light in which case the system moves the model from the on state to the forced off state.

  • home.event.courtesy.Event: tells the system someone is/is not near the light zone.

    • home.event.courtesy.Event.On -> the system will turn the light on, as a courtesy, if the sun brightness in the light zone is very low. The system will put the light in an alarmed state if the alarm in the light zone was armed.

    • home.event.courtesy.Event.Off -> the system will turn the light off only if there is nobody both near the zone light and in the zone light and the light was not forced on.

  • home.event.presence.Event: tells the system someone is/is not in the light zone.

    • home.event.presence.Event.On -> the system will turn the light on if the brightness in the light zone is very low. The system will put the light in an alarmed state if the alarm in the light zone was armed.

    • home.event.presence.Event.Off -> the system will turn the light off if the light is not alarmed or forced on.

  • home.event.alarm.armed.Event: tells the system the alarm is/is not armed in the light zone.

    • home.event.alarm.armed.Event.On -> the system will turn the light off even if it was forced on since no one should be in the light zone.

    • home.event.alarm.armed.Event.Off -> the system will turn the light off if it were turned on by a the triggered alarm.

  • home.sun.brightness.Event.(Bright|Dark|DeepDark): tells the system the sun brightness in the light zone is very low/low/high.

    • home.sun.brightness.Event.DeepDark -> the system will turn on the light in the above cases.

    • home.sun.brightness.Event.Dark -> the system will do nothing.

    • home.sun.brightness.Event.Bright -> the system will turn the light off even if it was forced on.

  • home.toggle.Event.(On|Off): tells the system to toggle on/off when in alarmed state.

Final states:

  • Forced on

  • Forced off

  • On

  • Off

  • Alarmed on

  • Alarmed off

Default state is Off.

>>> import home
>>> l = home.appliance.light.zone.Appliance("a zone light", [])
>>> _, new = l.notify(home.event.sun.brightness.Event.DeepDark)
>>> new.compute()
'Off'
>>> _, new = l.notify(home.event.presence.Event.On)
>>> new.compute()
'On'
>>> _, new = l.notify(home.event.presence.Event.Off)
>>> new.compute()
'Off'
>>> l.disable(home.event.presence.Event.On)
>>> l.is_enabled(home.event.presence.Event.Off)
False
>>> _, new = l.notify(home.event.presence.Event.On)
>>> new.compute()
'Off'
>>> l.enable(home.event.presence.Event.On)
>>> new.compute()
'Off'
>>> _, new = l.notify(home.event.alarm.armed.Event.On)
>>> new.compute()
'Off'
>>> _, new = l.notify(home.event.presence.Event.On)
>>> new.compute()
'Alarmed On'
>>> _, new = l.notify(home.appliance.light.event.forced.Event.Off)
>>> new.compute()
'Alarmed On'

light.indoor.dimmerable.Appliance

class home.appliance.light.indoor.dimmerable.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A light which can work in four different modes and in every moment it can switch between its working modes.

  • It can follow circadian rhythm events when in a forced circadian rhythm state. A scheduler trigger will notify circadian rhythm brightness/temperature events during the day making the light adjusting its settings.

  • It can follow lux balancing events when in a forced lux balancing state. A scheduler trigger linked to a sun lux balancing protocol trigger will notify lux balancing brightness events making the light adjusting its brightness accordingly to the sun brightness. The less bright will be the sun the more bright will be the light.

  • It can automatically change its brightness and temperature with a given period of time, for a given number of cycles, starting and ending from given show colors when in a forced show state.

  • It can have a fixed brightness when in a forced on state. Its brightness/temperature will be adjusted only by the user.

This light model reacts to the following events:

  • home.appliance.light.event.forced.Event: tells the system a user turned in a forced on/circadian rhythm/lux balancing/show state the light.

    • home.appliance.light.event.forced.Event.On -> the system will put the light in a forced on state.

    • home.appliance.light.event.forced.Event.CircadianRhythm -> the system will put the light in a forced circadian rhythm state.

    • home.appliance.light.event.forced.Event.LuxBalancing -> the system will put the light in a forced lux balancing state.

    • home.appliance.light.event.forced.Event.Show -> the system will put the light in a forced show state.

    • home.appliance.light.event.forced.Event.Off -> the system will put the light in a forced off state which is an off state.

  • home.event.presence.Event: tells the system someone could/could not being using the light

    • home.event.presence.Event.On -> the system will do nothing.

    • home.event.presence.Event.Off -> the system will un-force a forced on light because nobody is supposed to be using the light.

  • home.appliance.event.brightness.Event: tells the system the user desired brightness, used by the system when the light is in a forced on state

  • home.appliance.event.circadian_rhythm.brightness.Event: tells the system the actual circadian rhythm brightness, used by the system when the light is in a forced circadian rhythm state

  • home.appliance.event.lux_balancing.brightness.Event: tells the system the actual lux balancing brightness, used by the system when the light is in a forced lux balancing state

  • home.appliance.event.show.starting_brightness.Event: tells the system the show have to start with show starting brightness, used by the system when the light is in a forced show state

  • home.appliance.event.show.ending_brightness.Event: tells the system the show have to end with show ending brightness, used by the system when the light is in a forced show state

  • home.appliance.event.show.period.Event: tells the system the show have to last for period event, used by the system when the light is in a forced show state

  • home.appliance.event.show.period.Event: tells the system the show have to repeat itself for cycles event, used by the system when the light is in a forced show state

  • home.event.waveform.Event: tells the system the show transition from starting to ending brightness have to be in the form of waveform event, used by the system when the light is in a forced show state

Final states:

  • Forced on

  • Forced circadian rhythm

  • Forced lux balancing

  • Forced show

  • Off

Default state is Off.

>>> import home
>>> l = home.appliance.light.indoor.dimmerable.Appliance("a light", [])
>>> old, new = l.notify(home.appliance.light.indoor.dimmerable.event.forced.Event.On)
>>> old.compute()
'Off'
>>> new.compute()
'Forced On'
>>> old, new = l.notify(home.appliance.light.indoor.dimmerable.event.forced.Event.Off)
>>> new.compute()
'Off'

light.indoor.hue.Appliance

class home.appliance.light.indoor.hue.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A light which can work in four different modes and in every moment it can switch between its working modes.

  • It can follow circadian rhythm events when in a forced circadian rhythm state. A scheduler trigger will notify circadian rhythm brightness/hue/saturation/temperature events during the day making the light adjusting its settings.

  • It can follow lux balancing events when in a forced lux balancing state. A scheduler trigger linked to a sun lux balancing protocol trigger will notify lux balancing brightness events making the light adjusting its brightness accordingly to the sun brightness. The less bright will be the sun the more bright will be the light.

  • It can automatically change its hue, saturation, brightness and temperature with a given period of time, for a given number of cycles, starting and ending from given show colors when in a forced show state.

  • It can have a fixed brightness when in a forced on state. Its brightness/hue/saturation/temperature will be adjusted only by the user.

This light model reacts to the following events:

  • home.appliance.light.event.forced.Event: tells the system a user turned in a forced on/circadian rhythm/lux balancing/show state the light.

    • home.appliance.light.event.forced.Event.On -> the system will put the light in a forced on state.

    • home.appliance.light.event.forced.Event.CircadianRhythm -> the system will put the light in a forced circadian rhythm state.

    • home.appliance.light.event.forced.Event.LuxBalancing -> the system will put the light in a forced lux balancing state.

    • home.appliance.light.event.forced.Event.Show -> the system will put the light in a forced show state.

    • home.appliance.light.event.forced.Event.Off -> the system will put the light in a forced off state which is an off state.

  • home.event.presence.Event: tells the system someone could/could not being using the light

    • home.event.presence.On -> the system will do nothing.

    • home.event.presence.Off -> the system will un-force a forced on light because nobody is supposed to be using the light.

  • home.appliance.event.brightness.Event: tells the system the user desired brightness, used by the system when the light is in a forced on state

  • home.appliance.event.hue.Event: tells the system the user desired hue, used by the system when the light is in a forced on state

  • home.appliance.event.saturation.Event: tells the system the user desired saturation, used by the system when the light is in a forced on state

  • home.appliance.event.temperature.Event: tells the system the user desired temperature, used by the system when the light is in a forced on state

  • home.appliance.event.circadian_rhythm.brightness.Event: tells the system the actual circadian rhythm brightness, used by the system when the light is in a forced circadian rhythm state

  • home.appliance.event.circadian_rhythm.hue.Event: tells the system the actual circadian rhythm hue, used by the system when the light is in a forced circadian rhythm state

  • home.appliance.event.circadian_rhythm.saturation.Event: tells the system the actual circadian rhythm saturation, used by the system when the light is in a forced circadian rhythm state

  • home.appliance.event.circadian_rhythm.temperature.Event: tells the system the actual circadian rhythm temperature, used by the system when the light is in a forced circadian rhythm state

  • home.appliance.event.lux_balancing.brightness.Event: tells the system the actual lux balancing brightness, used by the system when the light is in a forced lux balancing state

  • home.appliance.event.show.starting_brightness.Event: tells the system the show have to start with show starting brightness, used by the system when the light is in a forced show state

  • home.appliance.event.show.starting_hue.Event: tells the system the show have to start with show starting hue, used by the system when the light is in a forced show state

  • home.appliance.event.show.ending_brightness.Event: tells the system the show have to end with show ending brightness, used by the system when the light is in a forced show state

  • home.appliance.event.show.ending_hue.Event: tells the system the show have to end with show ending hue, used by the system when the light is in a forced show state

  • home.appliance.event.show.period.Event: tells the system the show have to last for period event, used by the system when the light is in a forced show state

  • home.appliance.event.show.period.Event: tells the system the show have to repeat itself for cycles event, used by the system when the light is in a forced show state

  • home.event.waveform.Event: tells the system the show transition from starting to ending brightness have to be in the form of waveform event, used by the system when the light is in a forced show state

Final states:

  • Forced on

  • Forced circadian rhythm

  • Forced lux balancing

  • Forced show

  • Off

Default state is Off.

>>> import home
>>> l = home.appliance.light.indoor.hue.Appliance("a light", [])
>>> old, new = l.notify(home.appliance.light.indoor.dimmerable.event.forced.Event.On)
>>> old.compute()
'Off'
>>> new.compute()
'Forced On'
>>> old, new = l.notify(home.appliance.light.indoor.dimmerable.event.forced.Event.Off)
>>> new.compute()
'Off'

Sockets

socket.presence.Appliance

class home.appliance.socket.presence.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A socket automatically turned off when no one is supposed to be using it. Because, as an example, the alarm system is armed.

This socket model reacts to the following events:

  • home.appliance.socket.event.forced.Event: tells the system a user turned on/off the socket.

    • home.appliance.socket.event.forced.Event.On -> the user turned on the socket; the system moves the socket model from off state to forced on state.

    • home.appliance.socket.event.forced.Event.Off -> the user turned off the socket; the system moves the socket model from forced on state to off state since the off state is the default state.

  • home.event.presence.Event: tells the system someone could/could not being using the socket

    • home.event.presence.Event.On -> the system will do nothing.

    • home.event.presence.Event.Off -> the system will un-force a forced on socket because nobody is supposed to be using the light.

Final states:

  • Forced on

  • Off

Default state is Off.

>>> import home
>>> p = home.appliance.socket.presence.Appliance("a presence socket", [])
>>> _, new = p.notify(home.appliance.socket.event.forced.Event.On)
>>> new.compute()
'Forced On'
>>> _, new = p.notify(home.event.presence.Event.Off)
>>> new.compute()
'Off'
>>> _, new = p.notify(home.event.presence.Event.On)
>>> new.compute()
'Off'

socket.presence.christmas.Appliance

class home.appliance.socket.presence.christmas.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A socket which is by default on. Designed to automate a socket with plugged in a tv, a voice controller, a Christmas tree ecc.

It is automatically turned off when no one is supposed to be using it unless it is Christmas time.

This socket model reacts to the following events:

  • home.appliance.socket.event.forced.Event: tells the system a user turned on/off the socket.

    • home.appliance.socket.event.forced.Event.On -> the system will un-force a forced on socket if no one is considered being using it.

    • home.appliance.socket.event.forced.Event.Off -> the system will never un-force a forced off socket, which is in a off state since off is the default state.

  • home.event.presence.Event: tells the system someone could/could not being using the socket

    • home.event.presence.Event.On -> the system will do nothing.

    • home.event.presence.Event.Off -> the system will un-force a forced on socket because nobody is supposed to be using the light.

  • home.sun.brightness.Event.(Bright|Dark|DeepDark): tells the system the sun brightness level.

    • home.sun.brightness.Event.DeepDark -> the system will turn on the socket even if nobody is supposed to be using it just at Christmas time.

    • home.sun.brightness.Event.Dark -> the system will do nothing.

    • home.sun.brightness.Event.Bright -> the system will turn the light off if nobody is supposed to be using it.

  • home.holiday.christmas.Event.(Over|Day|Eve|Time): tells the system is/is not christmas time/day.

    • home.holiday.christmas.Event.Over -> the system will turn off the socket if nobody is supposed to be using it.

    • home.holiday.christmas.Event.(Day|Eve) -> the system will turn on the socket even if nobody is supposed to be using it or sun brightness level is high.

    • home.holiday.christmas.Event.Time -> the system will turn on the socket even if nobody is supposed to be using it if the sun brightness level is very low.

  • home.holiday.san_silvester.Event.(Over|Day|Eve|Time): tells the system is/is not christmas time/day.

    • home.holiday.san_silvester.Event.Over -> the system will turn off the socket if nobody is supposed to be using it.

    • home.holiday.san_silvester.Event.(Day|Eve) -> the system will turn on the socket even if nobody is supposed to be using it or sun brightness level is high.

    • home.holiday.san_silvester.Event.Time -> the system will turn on the socket even if nobody is supposed to be using it if the sun brightness level is very low.

  • home.holiday.epiphany.Event.(Over|Day|Eve|Time): tells the system is/is not christmas time/day.

    • home.holiday.epiphany.Event.Over -> the system will turn off the socket if nobody is supposed to be using it.

    • home.holiday.epiphany.Event.(Day|Eve) -> the system will turn on the socket even if nobody is supposed to be using it or sun brightness level is high.

    • home.holiday.epiphany.Event.Time -> the system will turn on the socket even if nobody is supposed to be using it if the sun brightness level is very low.

Final states:

  • Forced on

  • Forced off

  • On

  • Off

Default state is On.

>>> import home
>>> p = home.appliance.socket.presence.christmas.Appliance("a presence Christmas socket", [])
>>> _, new = p.notify(home.event.holiday.christmas.Event.Time)
>>> _, new = p.notify(home.event.sun.brightness.Event.DeepDark)
>>> new.compute()
'On'
>>> _, new = p.notify(home.event.presence.Event.Off)
>>> new.compute()
'Off'
>>> _, new = p.notify(home.event.holiday.christmas.Event.Over)
>>> new.compute()
'Off'

socket.energy_guard.Appliance

class home.appliance.socket.energy_guard.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A socket which is by default on. Designed to let the system control the home’s power consumption. This socket is supposed to have plugged in a load like a dishwasher.

A energy guard socket enters a detachable state when its detach logic is enabled and power consuming levels are too much high.

A energy guard socket enters an off state when its detach logic is enabled and power consuming levels are too much high for too much time.

When power consuming levels lower down it will be turned on again by the system.

You could have more energy guard sockets. A socket can enable the detach logic of another socket when turning itself off.

This will design a priority level between sockets.

  1. when a socket is turned off then it will enable the detach logic of another socket A -> enables -> B -> enables -> C -> enables -> D

  2. when a socket is turned on then it will disable its detach logic by itself,

  3. when power consuming levels are high again than will be enabled the detach logic for the lowest priority socket

This socket model reacts to the following events:

  • home.appliance.socket.event.forced.Event: tells the system a user turned on/off the socket.

    • home.appliance.socket.event.forced.Event.On -> a user forced on an off socket.

    • home.appliance.socket.event.forced.Event.Off -> a user forced off an on socket.

  • home.event.enable.Event: tells the system that the detachable logic for this socket could/could not being enabled

    • home.event.enable.Event.On -> the system will let this socket be put in a detachable state.

    • home.event.enable.Event.Off -> the system will not let this socket be put in a detachable state.

  • home.event.power.consumption.Event.(No|Low|High): tells the system how is the power consumption level in the home.

    • home.event.power.consumption.Event.(No|Low) -> the system will turn on the socket.

    • home.event.power.consumption.Event.(High) -> the system will turn off the socket if it is in a detachable state and the high power consumption last from long time.

  • home.event.power.consumption.duration.Event.(Short|Long): tells the system how long last the high power consumption level in the home.

    • home.event.power.consumption.duration.Event.Short -> the system will do nothing.

    • home.event.power.consumption.duration.Event.Long -> the system will turn off the socket if it is in a detachable state and the power consumption level is high.

Final states:

  • Forced off

  • Forced on

  • Off

  • On

  • Detachable

Default state is On.

>>> import home
>>> p = home.appliance.socket.energy_guard.Appliance("a energy guard socket", [])
>>> old, new = p.notify(home.event.enable.Event.On)
>>> old.compute()
'On'
>>> new.compute()
'On'
>>> _, new = p.notify(home.event.power.consumption.Event.High)
>>> _, new = p.notify(home.event.power.consumption.duration.Event.Long)
>>> new.compute()
'Off'
>>> _, new = p.notify(home.event.power.consumption.Event.No)
>>> new.compute()
'On'
>>> _, new = p.notify(home.event.power.consumption.Event.High)
>>> new.compute()
'On'
>>> _, new = p.notify(home.event.enable.Event.On)
>>> _, new = p.notify(home.event.power.consumption.duration.Event.Long)
>>> new.compute()
'Off'
>>> _, new = p.notify(home.event.power.consumption.Event.No)
>>> new.compute()
'On'
>>> _, new = p.notify(home.appliance.socket.event.forced.Event.Off)
>>> new.compute()
'Forced Off'

Curtains

curtain.indoor.blackout.Appliance

class home.appliance.curtain.indoor.blackout.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

An indoor blackout Curtain. Designed to model an indoor automated curtain in a bedroom.

It will be closed by the system at the sunset.

It will be opened by the system when its time to wake up the user.

It can be forced opened or forced closed by the user.

This curtain model reacts to the following events:

  • home.appliance.curtain.event.forced.Event.(Opened|Closed): tells the system a user opened/closed the curtain.

    • home.appliance.curtain.event.forced.Event.Opened -> a user forced opened a closed curtain.

    • home.appliance.curtain.event.forced.Event.Closed -> a user forced closed an opened curtain.

  • home.event.sun.twilight.civil.Event.(Sunrise|Sunset): tells the system that it is sunrise/sunset.

    • home.event.sun.twilight.civil.Event.Sunrise -> the system will open the curtain if the user should not yet being asleep.

    • home.event.sun.twilight.civil.Event.Sunset -> the system will close the curtain.

  • home.event.sleepiness.Event.(Asleep|Awake|Sleepy): tells the system that the user should be asleep/awake.

    • home.event.sleepiness.Event.(Asleep|Sleepy) -> the system will do nothing.

    • home.event.sleepiness.Event.Awake -> the system will open the curtain if the sun is already rised.

Final states:

  • Forced closed

  • Forced opened

  • Closed

  • Opened

Default state is Opened.

>>> import home
>>> c = home.appliance.curtain.indoor.blackout.Appliance("a curtain", [])
>>> old, new = c.notify(home.event.sun.twilight.civil.Event.Sunset)
>>> new.compute()
'Closed'
>>> old, new = c.notify(home.event.sleepiness.Event.Asleep)
>>> old, new = c.notify(home.event.sun.twilight.civil.Event.Sunrise)
>>> new.compute()
'Closed'
>>> old, new = c.notify(home.event.sleepiness.Event.Awake)
>>> new.compute()
'Opened'

curtain.outdoor.Appliance

class home.appliance.curtain.outdoor.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

An outdoor Curtain. Designed to model an automated outdoor curtain.

It will be closed by the system when the sun (with an high brightness) hits the curtain’s window or at sunset.

It will be opened by the system at sunrise or when the wind is strong.

It can be forced opened or forced closed by the user.

This curtain model reacts to the following events:

  • home.appliance.curtain.event.forced.Event.(Opened|Closed): tells the system a user opened/closed the curtain.

    • home.appliance.curtain.event.forced.Event.Opened -> a user forced opened a closed curtain.

    • home.appliance.curtain.event.forced.Event.Closed -> a user forced closed an opened curtain.

  • home.event.sun.brightness.Event.(DeepDark|Dark|Bright): tells the system the sun brightness level.

    • home.event.sun.brightness.Event.(DeepDark|Dark) -> the system will open a closed curtain unless the user forced closed it or the sun is already set.

    • home.event.sun.brightness.Event.Bright -> the system will close an opened curtain if the sun is hitting the curtain’s window unless the user forced closed it or the wind is strong.

  • home.event.sun.twilight.civil.Event.(Sunrise|Sunset): tells the system that it is sunrise/sunset.

    • home.event.sun.twilight.civil.Event.Sunrise -> the system will open the curtain.

    • home.event.sun.twilight.civil.Event.Sunset -> the system will close the curtain unless the wind is strong.

  • home.event.sun.hit.Event: tells the system that the sun is/is not hitting the curtain’s window.

    • home.event.sun.hit.Event.On -> the system will close the curtain if the sun brightness is high and the wind is not strong and a user does not forced it opened.

    • home.event.sun.hit.Event.Off -> the system will open a closed curtain unless sun was already set or a user forced it closed.

  • home.event.wind.Event.(Weak|Strong): tells the system that the wind is weak/strong.

    • home.event.wind.Event.Weak -> the system will close an opened curtain unless it was forced opened.

    • home.event.wind.Event.Strong -> the system will open a closed curtain unless it was forced closed.

Final states:

  • Forced closed

  • Forced opened

  • Closed

  • Opened

Default state is Opened.

>>> import home
>>> c = home.appliance.curtain.outdoor.Appliance("a curtain", [])
>>> old, new = c.notify(home.appliance.curtain.event.forced.Event.Closed)
>>> old.compute()
'Opened'
>>> new.compute()
'Forced Closed'
>>> old, new = c.notify(home.event.wind.Event.Strong)
>>> new.compute()
'Forced Closed'
>>> old, new = c.notify(home.appliance.curtain.event.forced.Event.Not)
>>> new.compute()
'Opened'

Curtain States change slowly thus Forced States are designed to unlock themselves. If a Curtain has been Forced it will not remain Forced forever. A Forced State will be unlocked when it will transit through a reset State.

Said it in other words; if the system and the user agree than the Appliance will be unlocked.

>>> old, new = c.notify(home.event.wind.Event.Weak)
>>> old, new = c.notify(home.appliance.curtain.event.forced.Event.Closed)
>>> new.compute()
'Forced Closed'
>>> old, new = c.notify(home.event.sun.brightness.Event.Bright)
>>> new.compute()
'Forced Closed'
>>> old, new = c.notify(home.event.sun.hit.Event.Sunhit)
>>> new.compute()
'Closed'
>>> old, new = c.notify(home.event.sun.hit.Event.Sunleft)
>>> new.compute()
'Opened'

curtain.outdoor.bedroom.Appliance

class home.appliance.curtain.outdoor.bedroom.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

An outdoor bedroom Curtain. Designed to model an outdoor automated curtain to be used in a bedroom.

It will be closed by the system when the sun (with an high brightness) hits the curtain’s window or at sunset.

It will be opened by the system when it is time to wake up the user (after sunrise) or when the wind is strong.

It could be forced opened or forced closed by a user.

This curtain model reacts to the following events:

  • home.appliance.curtain.event.forced.Event.(Opened|Closed): tells the system a user opened/closed the curtain.

    • home.appliance.curtain.event.forced.Event.Opened -> a user forced opened a closed curtain.

    • home.appliance.curtain.event.forced.Event.Closed -> a user forced closed an opened curtain.

  • home.event.sun.brightness.Event.(DeepDark|Dark|Bright): tells the system the sun brightness level.

    • home.event.sun.brightness.Event.(DeepDark|Dark) -> the system will open a closed curtain unless the user forced closed it or the sun is already set.

    • home.event.sun.brightness.Event.Bright -> the system will close an opened curtain if the sun is hitting the curtain’s window unless the user forced closed it or the wind is strong.

  • home.event.sun.twilight.civil.Event.(Sunrise|Sunset): tells the system that it is sunrise/sunset.

    • home.event.sun.twilight.civil.Event.Sunrise -> the system will open the curtain if the user should not yet being asleep.

    • home.event.sun.twilight.civil.Event.Sunset -> the system will close the curtain unless it is windy.

  • home.event.sun.hit.Event: tells the system that the sun is/is not hitting the curtain’s window.

    • home.event.sun.hit.Event.On -> the system will close the curtain if the sun brightness is high and the wind is not strong or a user forced it opened.

    • home.event.sun.hit.Event.Off -> the system will open a closed curtain unless sun was already set or a user forced it closed.

  • home.event.sleepiness.Event.(Asleep|Awake|Sleepy): tells the system that the user should be asleep/awake.

    • home.event.sleepiness.Event.(Asleep|Sleepy) -> the system will do nothing.

    • home.event.sleepiness.Event.Awake -> the system will open the curtain if the sun is already rised.

  • home.event.wind.Event.(Weak|Strong): tells the system that the wind is weak/strong.

    • home.event.wind.Event.Weak -> the system will close an opened curtain unless it was forced opened.

    • home.event.wind.Event.Strong -> the system will open a closed curtain unless it was forced closed.

Final states:

  • Forced closed

  • Forced opened

  • Closed

  • Opened

Default state is Opened.

>>> import home
>>> c = home.appliance.curtain.outdoor.bedroom.Appliance("a curtain", [])
>>> old, new = c.notify(home.event.sun.twilight.civil.Event.Sunset)
>>> new.compute()
'Closed'
>>> old, new = c.notify(home.event.sleepiness.Event.Asleep)
>>> old, new = c.notify(home.event.sun.twilight.civil.Event.Sunrise)
>>> new.compute()
'Closed'
>>> old, new = c.notify(home.event.sleepiness.Event.Awake)
>>> new.compute()
'Opened'

Sensors

sensor.luxmeter.Appliance

class home.appliance.sensor.luxmeter.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A Lux sensor.

Has just one state with an always changing lux value expressed in lux.

>>> import home
>>> l  = home.appliance.sensor.luxmeter.Appliance("lux sensor", [])
>>> old, new = l.notify(6000.0)
>>> old.compute()
'0.0 lux'
>>> new.compute()
'6000.0 lux'

sensor.anemometer.Appliance

class home.appliance.sensor.anemometer.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A Wind sensor.

Has just one state with an always changing wind value expressed in wsp.

>>> import home
>>> a  = home.appliance.sensor.anemometer.Appliance("wind sensor", [])
>>> old, new = a.notify(4.5)
>>> old.compute()
'0.0 wsp'
>>> new.compute()
'4.5 wsp'

sensor.powermeter.Appliance

class home.appliance.sensor.powermeter.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)
>>> import home
>>> a  = home.appliance.sensor.powermeter.Appliance("a meter", [])
>>> str(a)
'Appliance a meter in 0.0 W (computed from events: 0.0) and disabled events set()'

sensor.alarm.Appliance

class home.appliance.sensor.alarm.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)
>>> import home
>>> a  = home.appliance.sensor.alarm.Appliance("an alarm", [])
>>> str(a)
'Appliance an alarm in Unarmed (computed from events: home.event.alarm.armed.Event.Off, home.event.alarm.triggered.Event.Off) and disabled events set()'

Sound Players

sound.player.Appliance

class home.appliance.sound.player.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A sound player wich can be forced by the user in two different states.

  • It can follow circadian rhythm events when in a forced circadian rhythm state. A scheduler trigger will notify circadian rhythm playlist events during the day making the sound player adjusting the played playlist. The playlists, when in a circadian rhythm state, could be associated to three different users: A, B, C. A user will choose which are the associated playlist he wants to listen to.

  • It can have an almost fixed playlist and volume when in a forced on state. The playlist and volume will be adjusted only by the user.

The system puts the sound player in a fade in state when its time to wake up the user.

The system puts the sound player in a fade out state if the sound player is forced on or forced in a circadian rhythm state and its time for the user to go to bed.

This sound player model reacts to the following events:

  • home.appliance.sound.player.event.forced.Event: tells the system a user turned in a forced on/circadian rhythm state the sound player.

    • home.appliance.light.event.forced.Event.On -> the system will put the sound player in a forced on state.

    • home.appliance.light.event.forced.Event.CircadianRhythm -> the system will put the sound player in a forced circadian rhythm state.

    • home.appliance.light.event.forced.Event.Off -> the system will put the sound player in a forced off state which is an off state.

  • home.event.presence.Event: tells the system someone could/could not being using the sound player

    • home.event.presence.Event.On -> the system will do nothing.

    • home.event.presence.Event.Off -> the system will un-force a forced sound player because nobody is supposed to be using it.

  • home.event.sleepiness.Event.(Asleep|Awake|Sleepy): tells the system if the user should be asleep/awake/sleepy

    • home.event.sleepiness.Event.Asleep -> the system will put the sound player in a fade out state if already forced on or forced circadian rhythm.

    • home.event.sleepiness.Event.Awake -> the system will put the sound player in a fade in state.

    • home.event.sleepiness.Event.Sleepy -> the system will use the sleepy volume if forced on or forced in a circadian rhythm.

  • home.event.user.Event.(A|B|C): tells the system which user profile use, when in a forced circadian rhythm state

  • home.appliance.sound.player.event.playlist.Event: tells the system the playlist to be used, when the sound player is in a forced on state

  • home.appliance.sound.player.event.volume.Event: tells the system the volume to be used, when the sound player is in a forced on/circadian rhythm state

  • home.appliance.sound.player.event.sleepy_volume.Event: tells the system the volume to be used, when the sound player is in a forced on/circadian rhythm state and the user is supposed to be sleepy, like in the evening.

  • home.appliance.sound.player.event.forced.circadian_rhythm.playlist_a.Event: tells the system the playlist to be used for user A, when the sound player is in a forced circadian rhythm state

  • home.appliance.sound.player.event.forced.circadian_rhythm.playlist_b.Event: tells the system the playlist to be used for user B, when the sound player is in a forced circadian rhythm state

  • home.appliance.sound.player.event.forced.circadian_rhythm.playlist_c.Event: tells the system the playlist to be used for user C, when the sound player is in a forced circadian rhythm state

  • home.appliance.sound.player.event.fade_in.playlist.Event: tells the system the playlist to be used, when the sound player is in a fade in state

  • home.appliance.sound.player.event.fade_in.volume.Event: tells the system the volume to be used, when the sound player is in a fade in state

  • home.appliance.sound.player.event.fade_out.playlist.Event: tells the system the playlist to be used, when the sound player is in a fade out state

  • home.appliance.sound.player.event.fade_out.volume.Event: tells the system the volume to be used, when the sound player is in a fade out state

Final states:

  • Forced on

  • Forced circadian rhythm

  • Fade in

  • Fade out

  • Off

Default state is Off.

>>> import home
>>> p = home.appliance.sound.player.Appliance("a player", [])
>>> old, new = p.notify(home.appliance.sound.player.event.forced.Event.On)
>>> old.compute()
'Off'
>>> new.compute()
'Forced On'
>>> old, new = p.notify(home.appliance.sound.player.event.forced.Event.Not)
>>> new.compute()
'Off'

Sprinkler

sprinkler.Appliance

class home.appliance.sprinkler.Appliance(name: str, events: Iterable[home.Event] = None, events_disabled: Iterable[home.Event] = None)

A sprinkler automatically turned on by a scheduler event: the enable event. The sprinkler is turned on just after sunset and if is not raining. When on it is automatically turned off after the seconds specified in the duration event.

After sunrise is turned off even if someone forced it on.

If it has rained or if it will rain than it is turned in a state called partially on. When partially on it is automatically turned off after the seconds specified in the partially duration event.

This sprinkler model reacts to the following events:

  • home.appliance.sprinkler.event.forced.Event: tells the system a user turned on/off the sprinkler.

    • home.appliance.sprinkler.event.forced.Event.On -> the system will un-force a forced on sprinkler if it is raining or sun just rised.

    • home.appliance.sprinkler.event.forced.Event.Off -> the system will un-force a forced off sprinkler at sun set.

  • home.event.enable.Event: tells the system to enable/disable sprinkling.

    • home.event.enable.Event.On -> the system will turn the sprinkler on if the sun is set, is not raining, has not rained or will not rain. If has rained or will it rain than the system puts the sprinkler in a partially on state.

    • home.event.enable.Event.Off -> the system will turn the sprinkler off only if it was not forced on.

  • home.event.sun.phase.Event.(Sunset|Sunrise): tells the system the sun is set/is raised.

    • home.event.sun.phase.Event.Sunset -> the system will turn the sprinkler on if it is enabled and has not rained or will not rain. If it is enabled and has rained and will rain the system does nothing. If it is enabled and has rained or will rain the system puts the sprinkler in a partially on state. The system will put the light in an alarmed state if the alarm in the light zone was armed.

    • home.event.presence.Event.Sunrise -> the system will turn the sprinkler off.

  • home.event.rain.Event.(No|Gentle): tells the system is/is not raining.

    • home.event.rain.Event.Gentle -> the system will turn the sprinkler off even if it was forced on.

    • home.event.rain.Event.No -> the system will turn the sprinkler partially on if will no more rain and logic is enabled.

  • home.event.rain.forecast.Event: tells the system will/will not rain.

    • home.event.forecast.rain.Event.On -> the system will turn the sprinkler on if is no raining and has not rained. Otherwise will turn it partially on only if has not rained and is not raining.

    • home.event.forecast.rain.Event.Off -> the system will turn the sprinkler partially on if will no more rain and logic is enabled.

  • home.event.rain.in_the_past.Event: tells the system has/has not rained.

    • home.event.in_the_past.rain.Event.On -> the system will turn the sprinkler on if is no raining and will not rain. Otherwise will turn it partially on only if will not rained and is not raining.

    • home.event.in_the_past.rain.Event.Off -> the system will turn the sprinkler partially on if has not rained and logic is enabled.

  • home.appliance.sprinkler.event.duration.Event: tells the system how long sprinkling should last when in a on state.

  • home.appliance.sprinkler.event.partially_on.duration.Event: tells the system how long sprinkling should last when in a partially on state.

Final states:

  • Forced on

  • Forced partially on

  • Forced off

  • On

  • Partially on

  • Off

Default state is Off.

>>> import home
>>> l = home.appliance.sprinkler.Appliance("a sprinkler", [])
>>> _, new = l.notify(home.event.enable.Event.On)
>>> new.compute()
'Off'
>>> _, new = l.notify(home.event.sun.phase.Event.Sunset)
>>> new.compute()
'On'