├── .bdd_coveragerc ├── .coveragerc ├── .gitignore ├── .travis.yml ├── COPYING ├── DCO ├── README.md ├── docs ├── Makefile ├── automate-home.css ├── icon_128x128.png ├── images │ ├── devices_collections.png │ ├── dimmerable_graph.png │ ├── dimmerable_history.png │ ├── dimmerable_light.png │ ├── last_events.png │ ├── light_graphs.png │ ├── light_history.png │ ├── light_state.png │ ├── lights_collection.png │ ├── presence_graph.png │ ├── presence_history.png │ ├── presence_light.png │ ├── zone_graph.png │ ├── zone_history.png │ └── zone_light.png ├── index.html ├── make.bat ├── make_images.sh └── source │ ├── appliance.rst │ ├── appliance │ └── state.rst │ ├── appliances.rst │ ├── conf.py │ ├── example_projects.rst │ ├── features.rst │ ├── features │ ├── features.curtain_indoor_blackout.feature-file.rst │ ├── features.curtain_outdoor.feature-file.rst │ ├── features.curtain_outdoor_bedroom.feature-file.rst │ ├── features.light.feature-file.rst │ ├── features.light_indoor_dimmerable.feature-file.rst │ ├── features.light_indoor_hue.feature-file.rst │ ├── features.light_presence.feature-file.rst │ ├── features.light_zone.feature-file.rst │ ├── features.sensor_alarm.feature-file.rst │ ├── features.socket_energy_guard.feature-file.rst │ ├── features.socket_presence.feature-file.rst │ ├── features.socket_presence_christmas.feature-file.rst │ ├── features.sound_player.feature-file.rst │ ├── features.sprinkler.feature-file.rst │ ├── features.thermostat_presence.feature-file.rst │ └── gherkin.rst │ ├── gui │ ├── blockly_draft.png │ ├── collections.png │ ├── graphs.png │ ├── history.png │ ├── last_events.png │ ├── luci_semiinterrato.png │ ├── tenda_esterna.png │ ├── tende_esterne.png │ └── zone_light.png │ ├── index.rst │ ├── intro.rst │ ├── latex │ ├── event_from_protocol_sequence_diagram.tex │ ├── event_from_protocol_sequence_diagram.tex.png │ ├── event_from_protocol_sequence_diagram.tex.svg │ ├── other_projects_curtain.tex │ ├── other_projects_curtain.tex.png │ ├── other_projects_curtain.tex.svg │ ├── other_projects_garage_light.tex │ ├── other_projects_garage_light.tex.png │ ├── other_projects_garage_light.tex.svg │ ├── performer_class_diagram.tex │ ├── performer_class_diagram.tex.png │ ├── performer_class_diagram.tex.svg │ ├── performer_protocol_command_component_diagram.tex │ ├── performer_protocol_command_component_diagram.tex.png │ ├── performer_protocol_command_component_diagram.tex.svg │ ├── performer_protocol_trigger_component_diagram.tex │ ├── performer_protocol_trigger_component_diagram.tex.png │ ├── performer_protocol_trigger_component_diagram.tex.svg │ ├── quick_overview.tex │ ├── quick_overview.tex.png │ ├── quick_overview.tex.svg │ ├── scenario_lifx_command_multiple_performers.tex │ ├── scenario_lifx_command_multiple_performers.tex.png │ ├── scenario_lifx_command_multiple_performers.tex.svg │ ├── scenario_lifx_command_one_performer.tex │ ├── scenario_lifx_command_one_performer.tex.png │ ├── scenario_lifx_command_one_performer.tex.svg │ ├── scenario_light_trigger.tex │ ├── scenario_light_trigger.tex.png │ ├── scenario_light_trigger.tex.svg │ ├── scenario_lux_sensor.tex │ ├── scenario_lux_sensor.tex.png │ ├── scenario_lux_sensor.tex.svg │ ├── scenarios.tex │ ├── scenarios.tex.png │ ├── scenarios.tex.svg │ ├── scenarios_multiprotocol.tex │ ├── scenarios_multiprotocol.tex.png │ ├── scenarios_multiprotocol.tex.svg │ ├── scheduler_class_diagram.tex │ ├── scheduler_class_diagram.tex.png │ ├── scheduler_class_diagram.tex.svg │ ├── scheduler_event_sequence_diagram.tex │ ├── scheduler_event_sequence_diagram.tex.png │ ├── scheduler_event_sequence_diagram.tex.svg │ ├── this_project_curtain.tex │ ├── this_project_curtain.tex.png │ ├── this_project_curtain.tex.svg │ ├── this_project_garage_light.tex │ ├── this_project_garage_light.tex.png │ └── this_project_garage_light.tex.svg │ ├── my_home_real_project.rst │ ├── performer.rst │ ├── plugins.rst │ ├── project_curtains.rst │ ├── project_energy_guard.rst │ ├── project_lights.rst │ ├── project_sound_player.rst │ ├── projects.rst │ ├── scenes.rst │ ├── scenes_examples.rst │ └── scheduler.rst ├── home ├── __init__.py ├── __main__.py ├── appliance │ ├── __init__.py │ ├── attribute │ │ ├── __init__.py │ │ └── mixin.py │ ├── callable.py │ ├── collection.py │ ├── curtain │ │ ├── __init__.py │ │ ├── event │ │ │ ├── __init__.py │ │ │ └── forced │ │ │ │ ├── __init__.py │ │ │ │ └── event.py │ │ ├── indoor │ │ │ ├── __init__.py │ │ │ └── blackout │ │ │ │ ├── __init__.py │ │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── closed │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ ├── closed │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── opened │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── opened │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ └── outdoor │ │ │ ├── __init__.py │ │ │ ├── bedroom │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── closed │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ ├── closed │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── opened │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── opened │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── state │ │ │ ├── __init__.py │ │ │ ├── closed │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ │ ├── forced │ │ │ ├── __init__.py │ │ │ ├── closed │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── opened │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── opened │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ ├── data.py │ ├── event.py │ ├── light │ │ ├── __init__.py │ │ ├── event │ │ │ ├── __init__.py │ │ │ ├── brightness.py │ │ │ ├── circadian_rhythm │ │ │ │ ├── __init__.py │ │ │ │ ├── brightness.py │ │ │ │ ├── hue.py │ │ │ │ ├── saturation.py │ │ │ │ └── temperature.py │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ └── event.py │ │ │ ├── hue.py │ │ │ ├── lux_balancing │ │ │ │ ├── __init__.py │ │ │ │ └── brightness.py │ │ │ ├── saturation.py │ │ │ ├── show │ │ │ │ ├── __init__.py │ │ │ │ ├── cycles.py │ │ │ │ ├── ending_brightness.py │ │ │ │ ├── ending_hue.py │ │ │ │ ├── ending_saturation.py │ │ │ │ ├── period.py │ │ │ │ ├── starting_brightness.py │ │ │ │ ├── starting_hue.py │ │ │ │ └── starting_saturation.py │ │ │ └── temperature.py │ │ ├── indoor │ │ │ ├── __init__.py │ │ │ ├── dimmerable │ │ │ │ ├── __init__.py │ │ │ │ ├── event │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── forced │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── event.py │ │ │ │ └── state │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── forced │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── circadian_rhythm │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── callable.py │ │ │ │ │ │ └── state.py │ │ │ │ │ ├── lux_balance │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── callable.py │ │ │ │ │ │ └── state.py │ │ │ │ │ ├── on │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── callable.py │ │ │ │ │ │ └── state.py │ │ │ │ │ └── show │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── callable.py │ │ │ │ │ │ └── state.py │ │ │ │ │ ├── off │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ │ └── on │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ └── hue │ │ │ │ ├── __init__.py │ │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ ├── circadian_rhythm.py │ │ │ │ ├── lux_balance.py │ │ │ │ ├── on.py │ │ │ │ └── show.py │ │ │ │ ├── off.py │ │ │ │ └── on.py │ │ ├── presence │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ └── on │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ ├── state │ │ │ ├── __init__.py │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ ├── off │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── on │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ ├── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ ├── wall │ │ │ └── __init__.py │ │ └── zone │ │ │ ├── __init__.py │ │ │ └── state │ │ │ ├── __init__.py │ │ │ ├── alarmed │ │ │ ├── __init__.py │ │ │ ├── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ ├── forced │ │ │ ├── __init__.py │ │ │ ├── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ ├── off │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ │ └── on │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ ├── sensor │ │ ├── __init__.py │ │ ├── alarm │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── armed │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ ├── triggered │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ └── unarmed │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ ├── anemometer │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ └── __init__.py │ │ ├── callable │ │ │ └── __init__.py │ │ ├── crepuscular │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ └── __init__.py │ │ ├── luxmeter │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ └── __init__.py │ │ ├── motion │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── missed │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ └── spotted │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ ├── powermeter │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ └── __init__.py │ │ ├── rainmeter │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── gentle │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ └── no │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ ├── scene │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── triggered │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ └── untriggered │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ ├── state │ │ │ └── __init__.py │ │ └── thermometer │ │ │ ├── __init__.py │ │ │ └── state │ │ │ └── __init__.py │ ├── socket │ │ ├── __init__.py │ │ ├── energy_guard │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── detachable │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ ├── off │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── on │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ ├── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ └── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ ├── event │ │ │ ├── __init__.py │ │ │ └── forced │ │ │ │ ├── __init__.py │ │ │ │ └── event.py │ │ └── presence │ │ │ ├── __init__.py │ │ │ ├── christmas │ │ │ ├── __init__.py │ │ │ └── state │ │ │ │ ├── __init__.py │ │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ ├── off │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ └── on │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── callable.py │ │ │ │ │ └── state.py │ │ │ │ ├── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ │ └── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── state │ │ │ ├── __init__.py │ │ │ ├── forced │ │ │ ├── __init__.py │ │ │ └── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── off │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ ├── sound │ │ ├── __init__.py │ │ └── player │ │ │ ├── __init__.py │ │ │ ├── event │ │ │ ├── __init__.py │ │ │ ├── fade_in │ │ │ │ ├── __init__.py │ │ │ │ ├── playlist.py │ │ │ │ └── volume.py │ │ │ ├── fade_out │ │ │ │ ├── __init__.py │ │ │ │ ├── playlist.py │ │ │ │ └── volume.py │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ ├── circadian_rhythm │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── playlist_a.py │ │ │ │ │ ├── playlist_b.py │ │ │ │ │ └── playlist_c.py │ │ │ │ └── event.py │ │ │ ├── playlist.py │ │ │ ├── sleepy_volume.py │ │ │ └── volume.py │ │ │ └── state │ │ │ ├── __init__.py │ │ │ ├── fade_in │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ │ ├── fade_out │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ │ ├── forced │ │ │ ├── __init__.py │ │ │ ├── circadian_rhythm │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ ├── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── off │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ ├── sprinkler │ │ ├── __init__.py │ │ ├── event │ │ │ ├── __init__.py │ │ │ ├── duration.py │ │ │ ├── forced │ │ │ │ ├── __init__.py │ │ │ │ └── event.py │ │ │ └── partially_on │ │ │ │ ├── __init__.py │ │ │ │ └── duration.py │ │ └── state │ │ │ ├── __init__.py │ │ │ ├── forced │ │ │ ├── __init__.py │ │ │ ├── off │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ ├── on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ └── partially_on │ │ │ │ ├── __init__.py │ │ │ │ ├── callable.py │ │ │ │ └── state.py │ │ │ ├── off │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ │ ├── on │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ │ └── partially_on │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ ├── state.py │ └── thermostat │ │ ├── __init__.py │ │ └── presence │ │ ├── __init__.py │ │ ├── event │ │ ├── __init__.py │ │ ├── forced │ │ │ ├── __init__.py │ │ │ └── event.py │ │ ├── keep │ │ │ ├── __init__.py │ │ │ └── setpoint.py │ │ └── setpoint.py │ │ └── state │ │ ├── __init__.py │ │ ├── forced │ │ ├── __init__.py │ │ ├── keep │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ ├── off │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ └── on │ │ │ ├── __init__.py │ │ │ ├── callable.py │ │ │ └── state.py │ │ ├── keep │ │ ├── __init__.py │ │ ├── callable.py │ │ └── state.py │ │ ├── off │ │ ├── __init__.py │ │ ├── callable.py │ │ └── state.py │ │ └── on │ │ ├── __init__.py │ │ ├── callable.py │ │ └── state.py ├── builder │ ├── __init__.py │ ├── appliances.py │ ├── group_of_performers.py │ ├── listener │ │ ├── __init__.py │ │ └── resources.py │ ├── my_home.py │ ├── performers.py │ ├── schedule_infos.py │ ├── scheduler │ │ ├── __init__.py │ │ └── trigger │ │ │ ├── __init__.py │ │ │ ├── circadian_rhythm.py │ │ │ ├── crawler │ │ │ ├── __init__.py │ │ │ └── osmer_fvg │ │ │ │ ├── __init__.py │ │ │ │ └── will_rain │ │ │ │ ├── __init__.py │ │ │ │ ├── off.py │ │ │ │ └── on.py │ │ │ ├── cron.py │ │ │ ├── date │ │ │ ├── __init__.py │ │ │ └── resettable.py │ │ │ ├── interval.py │ │ │ ├── protocol │ │ │ ├── __init__.py │ │ │ ├── delay.py │ │ │ ├── enum.py │ │ │ ├── mean │ │ │ │ ├── __init__.py │ │ │ │ ├── greater_than.py │ │ │ │ ├── in_between.py │ │ │ │ └── lesser_than.py │ │ │ ├── multi.py │ │ │ └── timer.py │ │ │ ├── state │ │ │ ├── __init__.py │ │ │ ├── delay.py │ │ │ ├── entering │ │ │ │ ├── __init__.py │ │ │ │ └── delay │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── duration.py │ │ │ └── exiting │ │ │ │ ├── __init__.py │ │ │ │ └── delay.py │ │ │ └── sun │ │ │ ├── __init__.py │ │ │ ├── sunhit.py │ │ │ ├── sunleft.py │ │ │ ├── sunrise.py │ │ │ ├── sunset.py │ │ │ └── twilight │ │ │ ├── __init__.py │ │ │ ├── astronomical │ │ │ ├── __init__.py │ │ │ ├── sunrise.py │ │ │ └── sunset.py │ │ │ └── civil │ │ │ ├── __init__.py │ │ │ ├── sunrise.py │ │ │ └── sunset.py │ └── scheduler_triggers.py ├── configs.py ├── event │ ├── __init__.py │ ├── alarm │ │ ├── __init__.py │ │ ├── armed.py │ │ └── triggered.py │ ├── clima │ │ ├── __init__.py │ │ ├── command.py │ │ └── season.py │ ├── courtesy.py │ ├── elapsed.py │ ├── enable.py │ ├── enumeration.py │ ├── holiday │ │ ├── __init__.py │ │ ├── christmas.py │ │ ├── definition.py │ │ ├── easter.py │ │ ├── epiphany.py │ │ └── san_silvester.py │ ├── motion.py │ ├── power │ │ ├── __init__.py │ │ ├── consumption │ │ │ ├── __init__.py │ │ │ └── duration.py │ │ └── production │ │ │ ├── __init__.py │ │ │ └── duration.py │ ├── presence.py │ ├── rain │ │ ├── __init__.py │ │ ├── forecast.py │ │ └── in_the_past.py │ ├── scene.py │ ├── show.py │ ├── sleepiness.py │ ├── sun │ │ ├── __init__.py │ │ ├── brightness.py │ │ ├── hit.py │ │ ├── phase.py │ │ └── twilight │ │ │ ├── __init__.py │ │ │ ├── astronomical.py │ │ │ └── civil.py │ ├── temperature.py │ ├── toggle.py │ ├── user.py │ ├── waveform.py │ └── wind.py ├── example.ini ├── example_mac.ini ├── features │ ├── __init__.py │ ├── curtain_indoor_blackout.feature │ ├── curtain_outdoor.feature │ ├── curtain_outdoor_bedroom.feature │ ├── light.feature │ ├── light_indoor_dimmerable.feature │ ├── light_indoor_hue.feature │ ├── light_presence.feature │ ├── light_zone.feature │ ├── sensor_alarm.feature │ ├── socket_energy_guard.feature │ ├── socket_presence.feature │ ├── socket_presence_christmas.feature │ ├── sound_player.feature │ ├── sprinkler.feature │ ├── steps │ │ ├── __init__.py │ │ └── appliance.py │ └── thermostat_presence.feature ├── logger.py ├── my_home.py ├── options.py ├── performer.py ├── process.py ├── protocol │ ├── __init__.py │ ├── gateway.py │ ├── mean.py │ └── message.py ├── redis │ ├── __init__.py │ └── gateway │ │ ├── __init__.py │ │ ├── client │ │ ├── __init__.py │ │ ├── appliance.py │ │ ├── performer.py │ │ ├── pubsub.py │ │ └── storage.py │ │ └── serialization │ │ ├── __init__.py │ │ ├── appliance.py │ │ ├── brightness.py │ │ ├── circadian_rhythm │ │ ├── __init__.py │ │ ├── brightness.py │ │ ├── hue.py │ │ ├── playlist_a.py │ │ ├── playlist_b.py │ │ ├── playlist_c.py │ │ ├── saturation.py │ │ └── temperature.py │ │ ├── decoder.py │ │ ├── deserializer.py │ │ ├── duration.py │ │ ├── encoder.py │ │ ├── enumeration.py │ │ ├── event.py │ │ ├── event │ │ ├── __init__.py │ │ ├── float.py │ │ ├── int.py │ │ └── str.py │ │ ├── fade_in │ │ ├── __init__.py │ │ ├── playlist.py │ │ └── volume.py │ │ ├── fade_out │ │ ├── __init__.py │ │ ├── playlist.py │ │ └── volume.py │ │ ├── hue.py │ │ ├── keep │ │ ├── __init__.py │ │ └── setpoint.py │ │ ├── lux_balancing │ │ ├── __init__.py │ │ └── brightness.py │ │ ├── partially_on │ │ ├── __init__.py │ │ └── duration.py │ │ ├── performer.py │ │ ├── playlist.py │ │ ├── saturation.py │ │ ├── serializer.py │ │ ├── setpoint.py │ │ ├── show │ │ ├── __init__.py │ │ ├── cycles.py │ │ ├── ending_brightness.py │ │ ├── ending_hue.py │ │ ├── ending_saturation.py │ │ ├── period.py │ │ ├── starting_brightness.py │ │ ├── starting_hue.py │ │ └── starting_saturation.py │ │ ├── sleepy_volume.py │ │ ├── state.py │ │ ├── temperature.py │ │ └── volume.py ├── scheduler │ ├── __init__.py │ └── trigger │ │ ├── __init__.py │ │ ├── circadian_rhythm.py │ │ ├── crawler │ │ ├── __init__.py │ │ └── osmer_fvg │ │ │ ├── __init__.py │ │ │ └── will_rain │ │ │ ├── __init__.py │ │ │ ├── off.py │ │ │ └── on.py │ │ ├── cron.py │ │ ├── date │ │ ├── __init__.py │ │ └── resettable.py │ │ ├── interval.py │ │ ├── protocol │ │ ├── __init__.py │ │ ├── delay.py │ │ ├── enum.py │ │ ├── mean.py │ │ ├── multi.py │ │ └── timer.py │ │ ├── state │ │ ├── __init__.py │ │ ├── delay.py │ │ ├── entering │ │ │ ├── __init__.py │ │ │ └── delay │ │ │ │ ├── __init__.py │ │ │ │ └── duration.py │ │ └── exiting │ │ │ ├── __init__.py │ │ │ └── delay.py │ │ └── sun │ │ ├── __init__.py │ │ ├── follow.py │ │ ├── position.py │ │ ├── sunhit.py │ │ ├── sunleft.py │ │ ├── sunrise.py │ │ ├── sunset.py │ │ └── twilight │ │ ├── __init__.py │ │ ├── astronomical │ │ ├── __init__.py │ │ ├── sunrise.py │ │ └── sunset.py │ │ └── civil │ │ ├── __init__.py │ │ ├── sunrise.py │ │ └── sunset.py └── tests │ ├── __init__.py │ ├── builder │ ├── __init__.py │ ├── test_appliances.py │ ├── test_group_of_performers.py │ ├── test_helper.py │ ├── test_performers.py │ ├── test_schedule_infos.py │ ├── test_schedule_infos_for_triggers_of_state.py │ └── test_scheduler_triggers.py │ ├── redis │ ├── __init__.py │ └── test_serialization.py │ ├── test_doctests.py │ ├── test_scheduler_trigger_state.py │ ├── test_scheduler_trigger_state__by_redis.py │ ├── test_scheduler_trigger_state_duration.py │ ├── test_scheduler_trigger_state_more_than_once.py │ ├── test_scheduler_trigger_state_multiple.py │ ├── test_scheduler_trigger_state_volume.py │ ├── test_toggling_zone_light.py │ └── testcase.py ├── icon.svg ├── icon_128x128.png ├── requirements-dev.txt ├── requirements-doc.txt ├── requirements.txt └── setup.py /.bdd_coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | command_line = -m behave home/features 3 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | command_line = -m unittest discover 3 | omit = *tests*,*features*,*venv* 4 | 5 | [report] 6 | omit = *tests*,*features*,*venv* 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.bak 3 | .settings 4 | .project 5 | .pydevproject 6 | .idea 7 | .workspace.xml 8 | build/ 9 | dist/ 10 | *egg-info 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | env: 2 | - CODECOV_TOKEN='0b562994-3607-435e-80a8-416c33869baa' 3 | language: python 4 | python: 5 | - "3.8" 6 | before_install: 7 | - python --version 8 | - pip install -U pip 9 | - pip install -U pytest 10 | - pip install codecov 11 | - pip install -r requirements.txt 12 | - pip install -r requirements-dev.txt 13 | install: 14 | - python setup.py install 15 | # command to run tests 16 | script: 17 | - python -m coverage run 18 | - python -m coverage run --rcfile=.bdd_coveragerc --append > /dev/null 2>&1 19 | after_success: 20 | - codecov 21 | -------------------------------------------------------------------------------- /docs/automate-home.css: -------------------------------------------------------------------------------- 1 | family-sans-serif { 2 | font-family: 'Montserrat'; 3 | } 4 | 5 | .card-equal-height { 6 | display: flex; 7 | flex-direction: column; 8 | height: 100%; 9 | } -------------------------------------------------------------------------------- /docs/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/icon_128x128.png -------------------------------------------------------------------------------- /docs/images/devices_collections.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/devices_collections.png -------------------------------------------------------------------------------- /docs/images/dimmerable_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/dimmerable_graph.png -------------------------------------------------------------------------------- /docs/images/dimmerable_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/dimmerable_history.png -------------------------------------------------------------------------------- /docs/images/dimmerable_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/dimmerable_light.png -------------------------------------------------------------------------------- /docs/images/last_events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/last_events.png -------------------------------------------------------------------------------- /docs/images/light_graphs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/light_graphs.png -------------------------------------------------------------------------------- /docs/images/light_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/light_history.png -------------------------------------------------------------------------------- /docs/images/light_state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/light_state.png -------------------------------------------------------------------------------- /docs/images/lights_collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/lights_collection.png -------------------------------------------------------------------------------- /docs/images/presence_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/presence_graph.png -------------------------------------------------------------------------------- /docs/images/presence_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/presence_history.png -------------------------------------------------------------------------------- /docs/images/presence_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/presence_light.png -------------------------------------------------------------------------------- /docs/images/zone_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/zone_graph.png -------------------------------------------------------------------------------- /docs/images/zone_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/zone_history.png -------------------------------------------------------------------------------- /docs/images/zone_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/images/zone_light.png -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/source/example_projects.rst: -------------------------------------------------------------------------------- 1 | Example Projects 2 | ---------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 3 6 | 7 | .. project_lights 8 | .. project_curtains 9 | .. project_energy_guard 10 | .. project_sound_player 11 | .. my_home_real_project 12 | -------------------------------------------------------------------------------- /docs/source/features.rst: -------------------------------------------------------------------------------- 1 | Features 2 | ^^^^^^^^ 3 | 4 | .. _Features: 5 | 6 | .. toctree:: 7 | :maxdepth: 4 8 | 9 | features/features.light_zone.feature-file 10 | features/features.light_presence.feature-file 11 | features/features.light_indoor_dimmerable.feature-file 12 | features/features.light_indoor_hue.feature-file 13 | features/features.curtain_indoor_blackout.feature-file 14 | features/features.curtain_outdoor.feature-file 15 | features/features.curtain_outdoor_bedroom.feature-file 16 | features/features.socket_energy_guard.feature-file 17 | features/features.socket_presence.feature-file 18 | features/features.socket_presence_christmas.feature-file 19 | features/features.sound_player.feature-file 20 | -------------------------------------------------------------------------------- /docs/source/features/gherkin.rst: -------------------------------------------------------------------------------- 1 | Features 2 | ======== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | features.curtain_indoor_blackout.feature-file 8 | features.curtain_outdoor.feature-file 9 | features.curtain_outdoor_bedroom.feature-file 10 | features.light.feature-file 11 | features.light_indoor_dimmerable.feature-file 12 | features.light_indoor_hue.feature-file 13 | features.light_presence.feature-file 14 | features.light_zone.feature-file 15 | features.sensor_alarm.feature-file 16 | features.socket_energy_guard.feature-file 17 | features.socket_presence.feature-file 18 | features.socket_presence_christmas.feature-file 19 | features.sound_player.feature-file 20 | features.sprinkler.feature-file 21 | features.thermostat_presence.feature-file 22 | -------------------------------------------------------------------------------- /docs/source/gui/blockly_draft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/blockly_draft.png -------------------------------------------------------------------------------- /docs/source/gui/collections.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/collections.png -------------------------------------------------------------------------------- /docs/source/gui/graphs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/graphs.png -------------------------------------------------------------------------------- /docs/source/gui/history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/history.png -------------------------------------------------------------------------------- /docs/source/gui/last_events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/last_events.png -------------------------------------------------------------------------------- /docs/source/gui/luci_semiinterrato.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/luci_semiinterrato.png -------------------------------------------------------------------------------- /docs/source/gui/tenda_esterna.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/tenda_esterna.png -------------------------------------------------------------------------------- /docs/source/gui/tende_esterne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/tende_esterne.png -------------------------------------------------------------------------------- /docs/source/gui/zone_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/gui/zone_light.png -------------------------------------------------------------------------------- /docs/source/latex/event_from_protocol_sequence_diagram.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/event_from_protocol_sequence_diagram.tex.png -------------------------------------------------------------------------------- /docs/source/latex/other_projects_curtain.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/other_projects_curtain.tex.png -------------------------------------------------------------------------------- /docs/source/latex/other_projects_garage_light.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/other_projects_garage_light.tex.png -------------------------------------------------------------------------------- /docs/source/latex/performer_class_diagram.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/performer_class_diagram.tex.png -------------------------------------------------------------------------------- /docs/source/latex/performer_protocol_command_component_diagram.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/performer_protocol_command_component_diagram.tex.png -------------------------------------------------------------------------------- /docs/source/latex/performer_protocol_trigger_component_diagram.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/performer_protocol_trigger_component_diagram.tex.png -------------------------------------------------------------------------------- /docs/source/latex/quick_overview.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/quick_overview.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scenario_lifx_command_multiple_performers.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scenario_lifx_command_multiple_performers.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scenario_lifx_command_one_performer.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scenario_lifx_command_one_performer.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scenario_light_trigger.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scenario_light_trigger.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scenario_lux_sensor.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scenario_lux_sensor.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scenarios.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scenarios.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scenarios_multiprotocol.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scenarios_multiprotocol.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scheduler_class_diagram.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scheduler_class_diagram.tex.png -------------------------------------------------------------------------------- /docs/source/latex/scheduler_event_sequence_diagram.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/scheduler_event_sequence_diagram.tex.png -------------------------------------------------------------------------------- /docs/source/latex/this_project_curtain.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/this_project_curtain.tex.png -------------------------------------------------------------------------------- /docs/source/latex/this_project_garage_light.tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/docs/source/latex/this_project_garage_light.tex.png -------------------------------------------------------------------------------- /docs/source/my_home_real_project.rst: -------------------------------------------------------------------------------- 1 | My Home Project UI Example 2 | ========================== 3 | 4 | .. image:: gui/last_events.png 5 | 6 | .. image:: gui/collections.png 7 | 8 | .. image:: gui/tende_esterne.png 9 | 10 | .. image:: gui/tenda_esterna.png 11 | 12 | .. image:: gui/luci_semiinterrato.png 13 | 14 | .. image:: gui/zone_light.png 15 | 16 | .. image:: gui/history.png 17 | 18 | .. image:: gui/graphs.png 19 | -------------------------------------------------------------------------------- /docs/source/plugins.rst: -------------------------------------------------------------------------------- 1 | Protocols Integrations 2 | ====================== 3 | 4 | A small subset of protocol integrations are already available as plugins: 5 | 6 | * `automate-knx-plugin `_: **KNX** protocol integration. 7 | * `automate-lifx-plugin `_: **Lifx Lan** protocol integration. 8 | * `automate-sonos-plugin `_: **Sonos** protocol integration. 9 | * `automate-home-assistant-plugin `_: **Home Assistant** protocol integration. 10 | -------------------------------------------------------------------------------- /docs/source/projects.rst: -------------------------------------------------------------------------------- 1 | .. _example_projects: 2 | 3 | Example Projects 4 | ================ 5 | 6 | * `automate-lights-example `_ using **Lifx** and **KNX** protocol integrations. 7 | * `automate-curtains-example `_ using **KNX** and **Home Assistant** protocol integrations. 8 | * `automate-sockets-example `_ using **KNX** and **Home Assistant** protocol integrations. 9 | * `automate-sprinklers-example `_ using **KNX** protocol integration. 10 | * `automate-sound-player-example `_ using **KNX** and **Sonos** protocol integration. 11 | -------------------------------------------------------------------------------- /home/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home import event 8 | from home import appliance 9 | from home import protocol 10 | from home import redis 11 | from home import scheduler 12 | from home.appliance import Appliance 13 | from home.performer import Performer, Performers 14 | from home.my_home import MyHome 15 | from home import builder 16 | from home.process import Process 17 | from home import logger 18 | from home import options 19 | from home import configs 20 | from home.event import Event 21 | -------------------------------------------------------------------------------- /home/appliance/attribute/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.attribute import mixin 8 | -------------------------------------------------------------------------------- /home/appliance/curtain/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain import event 8 | from home.appliance.curtain import outdoor 9 | from home.appliance.curtain import indoor 10 | -------------------------------------------------------------------------------- /home/appliance/curtain/event/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.event import forced 8 | -------------------------------------------------------------------------------- /home/appliance/curtain/event/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.event.forced.event import Event 8 | -------------------------------------------------------------------------------- /home/appliance/curtain/event/forced/event.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | 9 | 10 | class Event(home.event.Enum): 11 | Opened = "Opened" 12 | Closed = "Closed" 13 | Not = "Not" 14 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.indoor import blackout 8 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/blackout/state/closed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.indoor.blackout.state.closed import callable 8 | from home.appliance.curtain.indoor.blackout.state.closed.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/blackout/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.indoor.blackout.state.forced import opened 8 | from home.appliance.curtain.indoor.blackout.state.forced import closed 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/blackout/state/forced/closed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.indoor.blackout.state.forced.closed import callable 8 | from home.appliance.curtain.indoor.blackout.state.forced.closed.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/blackout/state/forced/closed/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Sleepiness(callable.Forced): 11 | pass 12 | 13 | 14 | class SunTwilight(callable.Forced): 15 | pass 16 | 17 | 18 | class Forced(callable.Callable): 19 | def run(self, event, state): 20 | if event in (state.forced_enum.Not, state.forced_enum.Opened): 21 | state = self.compute_new_state(state, "base", [event]) 22 | return state 23 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/blackout/state/forced/opened/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.indoor.blackout.state.forced.opened import callable 8 | from home.appliance.curtain.indoor.blackout.state.forced.opened.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/blackout/state/forced/opened/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Sleepiness(callable.Forced): 11 | pass 12 | 13 | 14 | class SunTwilight(callable.Forced): 15 | pass 16 | 17 | 18 | class Forced(callable.Callable): 19 | def run(self, event, state): 20 | if event in (state.forced_enum.Not, state.forced_enum.Closed): 21 | state = self.compute_new_state(state, "base", [event]) 22 | return state 23 | -------------------------------------------------------------------------------- /home/appliance/curtain/indoor/blackout/state/opened/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.indoor.blackout.state.opened import callable 8 | from home.appliance.curtain.indoor.blackout.state.opened.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/bedroom/state/closed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.bedroom.state.closed import callable 8 | from home.appliance.curtain.outdoor.bedroom.state.closed.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/bedroom/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.bedroom.state.forced import opened 8 | from home.appliance.curtain.outdoor.bedroom.state.forced import closed 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/bedroom/state/forced/closed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.bedroom.state.forced.closed import callable 8 | from home.appliance.curtain.outdoor.bedroom.state.forced.closed.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/bedroom/state/forced/closed/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Sleepiness(callable.Forced): 11 | pass 12 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/bedroom/state/forced/opened/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.bedroom.state.forced.opened import callable 8 | from home.appliance.curtain.outdoor.bedroom.state.forced.opened.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/bedroom/state/forced/opened/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Sleepiness(callable.Forced): 11 | pass 12 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/bedroom/state/opened/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.bedroom.state.opened import callable 8 | from home.appliance.curtain.outdoor.bedroom.state.opened.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/state/closed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.state.closed import callable 8 | from home.appliance.curtain.outdoor.state.closed.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.state.forced import closed 8 | from home.appliance.curtain.outdoor.state.forced import opened 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/state/forced/closed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.state.forced.closed import callable 8 | from home.appliance.curtain.outdoor.state.forced.closed.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/state/forced/closed/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Wind(callable.Forced): 11 | pass 12 | 13 | 14 | class Brightness(callable.Callable): 15 | """ 16 | A Brightness event will not automatically unlock a Forced Curtain 17 | """ 18 | 19 | def run(self, event, state): 20 | return state 21 | 22 | 23 | class SunTwilight(callable.Forced): 24 | pass 25 | 26 | 27 | class SunHit(callable.Forced): 28 | pass 29 | 30 | 31 | class Forced(callable.Callable): 32 | def run(self, event, state): 33 | if event in (state.forced_enum.Not, state.forced_enum.Opened): 34 | state = self.compute_new_state(state, "base", [event]) 35 | return state 36 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/state/forced/opened/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.state.forced.opened import callable 8 | from home.appliance.curtain.outdoor.state.forced.opened.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/state/forced/opened/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Wind(callable.Forced): 11 | pass 12 | 13 | 14 | class Brightness(callable.Callable): 15 | """ 16 | A Brightness event will not automatically unlock a Forced Curtain 17 | """ 18 | 19 | def run(self, event, state): 20 | return state 21 | 22 | 23 | class SunTwilight(callable.Forced): 24 | pass 25 | 26 | 27 | class SunHit(callable.Forced): 28 | pass 29 | 30 | 31 | class Forced(callable.Callable): 32 | def run(self, event, state): 33 | if event in (state.forced_enum.Not, state.forced_enum.Closed): 34 | state = self.compute_new_state(state, "base", [event]) 35 | return state 36 | -------------------------------------------------------------------------------- /home/appliance/curtain/outdoor/state/opened/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.curtain.outdoor.state.opened import callable 8 | from home.appliance.curtain.outdoor.state.opened.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/data.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | registry = list() 8 | 9 | 10 | def register_class(target_class): 11 | klass = "{}.{}".format( 12 | target_class.__module__.replace(".definition", "").replace( 13 | "home.appliance.", "" 14 | ), 15 | target_class.__name__, 16 | ) 17 | registry.append(klass) 18 | 19 | 20 | class Registry(type): 21 | def __new__(mcs, name, bases, class_dict): 22 | cls = super().__new__(mcs, name, bases, class_dict) 23 | if name not in registry: 24 | register_class(cls) 25 | return cls 26 | -------------------------------------------------------------------------------- /home/appliance/light/event/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event import forced 8 | from home.appliance.light.event import ( 9 | brightness, 10 | hue, 11 | saturation, 12 | temperature, 13 | circadian_rhythm, 14 | lux_balancing, 15 | show, 16 | ) 17 | -------------------------------------------------------------------------------- /home/appliance/light/event/brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Int 8 | 9 | 10 | class Event(Int): 11 | """ 12 | An event carrying on brightness data 13 | 14 | >>> Event(80) 15 | Brightness: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._value = value % 101 21 | self._str = "Brightness: {}%" 22 | -------------------------------------------------------------------------------- /home/appliance/light/event/circadian_rhythm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.circadian_rhythm import brightness 8 | from home.appliance.light.event.circadian_rhythm import hue 9 | from home.appliance.light.event.circadian_rhythm import saturation 10 | from home.appliance.light.event.circadian_rhythm import temperature 11 | -------------------------------------------------------------------------------- /home/appliance/light/event/circadian_rhythm/brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.brightness import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on circadian brightness data 13 | 14 | >>> Event(80) 15 | Circadian brightness: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Circadian brightness: {}%" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/circadian_rhythm/hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.hue import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on circadian hue data 13 | 14 | >>> Event(80) 15 | Circadian hue: 80° 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Circadian hue: {}°" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/circadian_rhythm/saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.saturation import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on circadian saturation data 13 | 14 | >>> Event(80) 15 | Circadian saturation: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Circadian saturation: {}%" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/circadian_rhythm/temperature.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.temperature import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on circadian saturation data 13 | 14 | >>> Event(80) 15 | Circadian temperature: 80° kelvin 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Circadian temperature: {}° kelvin" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.forced.event import Event 8 | -------------------------------------------------------------------------------- /home/appliance/light/event/forced/event.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | 9 | 10 | class Event(home.event.Enum): 11 | On = "On" 12 | Off = "Off" 13 | Not = "Not" 14 | -------------------------------------------------------------------------------- /home/appliance/light/event/hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Int 8 | 9 | 10 | class Event(Int): 11 | """ 12 | An event carrying on hue data 13 | 14 | >>> Event(80) 15 | Hue: 80° 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._hue = value % 361 21 | self._str = "Hue: {}°" 22 | -------------------------------------------------------------------------------- /home/appliance/light/event/lux_balancing/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.lux_balancing import brightness 8 | -------------------------------------------------------------------------------- /home/appliance/light/event/lux_balancing/brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.brightness import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying a balanced brightness data 13 | 14 | >>> Event(80) 15 | Balanced brightness: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Balanced brightness: {}%" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Int 8 | 9 | 10 | class Event(Int): 11 | """ 12 | An event carrying on saturation data 13 | 14 | >>> Event(80) 15 | Saturation: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._hue = value % 101 21 | self._str = "Saturation: {}%" 22 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show import starting_brightness 8 | from home.appliance.light.event.show import starting_saturation 9 | from home.appliance.light.event.show import starting_hue 10 | from home.appliance.light.event.show import ending_brightness 11 | from home.appliance.light.event.show import ending_saturation 12 | from home.appliance.light.event.show import ending_hue 13 | from home.appliance.light.event.show import cycles 14 | from home.appliance.light.event.show import period 15 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/cycles.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | 8 | from home.appliance.event import Int 9 | 10 | 11 | class Event(Int): 12 | """ 13 | An event carrying on show cycles data 14 | 15 | >>> Event(80) 16 | Show cycles: 80 17 | """ 18 | 19 | def __init__(self, value: int): 20 | super(Event, self).__init__(value) 21 | self._str = "Show cycles: {}" 22 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/ending_brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.brightness import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on show ending brightness data 13 | 14 | >>> Event(80) 15 | Show ending brightness: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Show ending brightness: {}%" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/ending_hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.hue import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on show ending hue data 13 | 14 | >>> Event(80) 15 | Show ending hue: 80° 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Show ending hue: {}°" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/ending_saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.saturation import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on show ending saturation data 13 | 14 | >>> Event(80) 15 | Show ending saturation: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Show ending saturation: {}%" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/period.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Int 8 | 9 | 10 | class Event(Int): 11 | """ 12 | An event carrying on show period data 13 | 14 | >>> Event(80) 15 | Show period: 80 milliseconds 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Show period: {} milliseconds" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/starting_brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.brightness import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on show starting brightness data 13 | 14 | >>> Event(80) 15 | Show starting brightness: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Show starting brightness: {}%" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/starting_hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.hue import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on show starting hue data 13 | 14 | >>> Event(80) 15 | Show starting hue: 80° 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Show starting hue: {}°" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/show/starting_saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.saturation import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on show starting saturation data 13 | 14 | >>> Event(80) 15 | Show starting saturation: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Show starting saturation: {}%" 21 | -------------------------------------------------------------------------------- /home/appliance/light/event/temperature.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Int 8 | 9 | 10 | class Event(Int): 11 | """ 12 | An event carrying on temperature data 13 | 14 | >>> Event(80) 15 | Temperature: 80° kelvin 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Temperature: {}° kelvin" 21 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor import dimmerable 8 | from home.appliance.light.indoor import hue 9 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/event/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.event import forced 8 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/event/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.event.forced.event import Event 8 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/event/forced/event.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | 9 | 10 | class Event(home.event.Enum): 11 | On = "On" 12 | Off = "Off" 13 | CircadianRhythm = "CircadianRhythm" 14 | LuxBalance = "LuxBalance" 15 | Show = "Show" 16 | Not = "Not" 17 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced import on 8 | from home.appliance.light.indoor.dimmerable.state.forced import circadian_rhythm 9 | from home.appliance.light.indoor.dimmerable.state.forced import lux_balance 10 | from home.appliance.light.indoor.dimmerable.state.forced import show 11 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/circadian_rhythm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced.circadian_rhythm import ( 8 | callable, 9 | ) 10 | from home.appliance.light.indoor.dimmerable.state.forced.circadian_rhythm.state import ( 11 | State, 12 | Mixin, 13 | ) 14 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/circadian_rhythm/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced.on import callable 8 | 9 | 10 | class Presence(callable.Presence): 11 | pass 12 | 13 | 14 | class Brightness(callable.Brightness): 15 | pass 16 | 17 | 18 | class Forced(callable.Forced): 19 | pass 20 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/lux_balance/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced.lux_balance import callable 8 | from home.appliance.light.indoor.dimmerable.state.forced.lux_balance.state import ( 9 | State, 10 | Mixin, 11 | ) 12 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/lux_balance/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced.on import callable 8 | 9 | 10 | class Presence(callable.Presence): 11 | pass 12 | 13 | 14 | class Brightness(callable.Brightness): 15 | pass 16 | 17 | 18 | class Forced(callable.Forced): 19 | pass 20 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced.on import callable 8 | from home.appliance.light.indoor.dimmerable.state.forced.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/show/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced.show import callable 8 | from home.appliance.light.indoor.dimmerable.state.forced.show.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/forced/show/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.forced.on import callable 8 | 9 | 10 | class Presence(callable.Presence): 11 | pass 12 | 13 | 14 | class Brightness(callable.Brightness): 15 | pass 16 | 17 | 18 | class Forced(callable.Forced): 19 | pass 20 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.off import callable 8 | from home.appliance.light.indoor.dimmerable.state.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/dimmerable/state/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.dimmerable.state.on import callable 8 | from home.appliance.light.indoor.dimmerable.state.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/indoor/hue/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.indoor.hue.state.forced import on 8 | from home.appliance.light.indoor.hue.state.forced import show 9 | from home.appliance.light.indoor.hue.state.forced import circadian_rhythm 10 | from home.appliance.light.indoor.hue.state.forced import lux_balance 11 | -------------------------------------------------------------------------------- /home/appliance/light/presence/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.presence.state.forced import on 8 | -------------------------------------------------------------------------------- /home/appliance/light/presence/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.presence.state.forced.on import callable 8 | from home.appliance.light.presence.state.forced.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/presence/state/forced/on/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance import callable 9 | 10 | 11 | class Presence(callable.Callable): 12 | def run(self, event, state): 13 | if event == home.event.presence.Event.Off: 14 | state = self.compute_new_state(state, "base", [state.forced_enum.On]) 15 | return state 16 | 17 | 18 | class Forced(callable.Callable): 19 | def run(self, event, state): 20 | if event in (state.forced_enum.Not, state.forced_enum.Off): 21 | state = self.compute_new_state(state, "base", [event]) 22 | return state 23 | -------------------------------------------------------------------------------- /home/appliance/light/presence/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.presence.state.off import callable 8 | from home.appliance.light.presence.state.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/presence/state/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.callable import Callable 8 | 9 | 10 | class Presence(Callable): 11 | def run(self, event, state): 12 | return state 13 | 14 | 15 | class Forced(Callable): 16 | def run(self, event, state): 17 | if event == state.forced_enum.On: 18 | state = self.get_new_state(state, "forced_on") 19 | elif event != state.forced_enum.Not: 20 | state = state.unforce() 21 | return state 22 | -------------------------------------------------------------------------------- /home/appliance/light/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.state.forced import off 8 | from home.appliance.light.state.forced import on 9 | -------------------------------------------------------------------------------- /home/appliance/light/state/forced/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.state.forced.off import callable 8 | from home.appliance.light.state.forced.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/state/forced/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Courtesy(callable.Callable): 11 | """ 12 | A Courtesy event will not automatically unlock a Forced Light 13 | """ 14 | 15 | def run(self, event, state): 16 | return state 17 | 18 | 19 | class Brightness(callable.Forced): 20 | pass 21 | 22 | 23 | class Forced(callable.Callable): 24 | def run(self, event, state): 25 | if event in (state.forced_enum.Not, state.forced_enum.On): 26 | state = self.compute_new_state(state, "base", [event]) 27 | return state 28 | -------------------------------------------------------------------------------- /home/appliance/light/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.state.forced.on import callable 8 | from home.appliance.light.state.forced.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/state/forced/on/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Courtesy(callable.Callable): 11 | """ 12 | A Courtesy event will not automatically unlock a Forced Light 13 | """ 14 | 15 | def run(self, event, state): 16 | return state 17 | 18 | 19 | class Brightness(callable.Forced): 20 | pass 21 | 22 | 23 | class Forced(callable.Callable): 24 | def run(self, event, state): 25 | if event in (state.forced_enum.Not, state.forced_enum.Off): 26 | state = self.compute_new_state(state, "base", [event]) 27 | return state 28 | -------------------------------------------------------------------------------- /home/appliance/light/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.state.off import callable 8 | from home.appliance.light.state.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/state/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.state.on import callable 8 | from home.appliance.light.state.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/wall/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/alarmed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.alarmed import on, off 8 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/alarmed/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.alarmed.off import callable 8 | from home.appliance.light.zone.state.alarmed.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/alarmed/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | from home.appliance.light.zone.state.alarmed.on import callable as on_callable 10 | 11 | 12 | class Presence(on_callable.Presence): 13 | pass 14 | 15 | 16 | class Courtesy(on_callable.Courtesy): 17 | pass 18 | 19 | 20 | class Brightness(on_callable.Brightness): 21 | pass 22 | 23 | 24 | class Toggle(Callable): 25 | def run(self, event, state): 26 | if event == home.event.toggle.Event.On: 27 | state = self.get_new_state(state, "alarmed_on") 28 | return state 29 | 30 | 31 | class Armed(on_callable.Armed): 32 | pass 33 | 34 | 35 | class Forced(on_callable.Forced): 36 | pass 37 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/alarmed/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.alarmed.on import callable 8 | from home.appliance.light.zone.state.alarmed.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.forced import off 8 | from home.appliance.light.zone.state.forced import on 9 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/forced/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.forced.off import callable 8 | from home.appliance.light.zone.state.forced.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/forced/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Presence(callable.Forced): 11 | pass 12 | 13 | 14 | class Courtesy(callable.Forced): 15 | pass 16 | 17 | 18 | class Brightness(callable.Forced): 19 | pass 20 | 21 | 22 | class Armed(callable.Forced): 23 | pass 24 | 25 | 26 | class Toggle(callable.Forced): 27 | pass 28 | 29 | 30 | class Forced(callable.Callable): 31 | def run(self, event, state): 32 | if event in (state.forced_enum.Not, state.forced_enum.On): 33 | state = self.compute_new_state(state, "base", [event]) 34 | return state 35 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.forced.on import callable 8 | from home.appliance.light.zone.state.forced.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.off import callable 8 | from home.appliance.light.zone.state.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/light/zone/state/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.zone.state.on import callable 8 | from home.appliance.light.zone.state.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor import ( 8 | scene, 9 | motion, 10 | alarm, 11 | powermeter, 12 | crepuscular, 13 | rainmeter, 14 | anemometer, 15 | thermometer, 16 | luxmeter, 17 | ) 18 | from home.appliance.sensor import state 19 | from home.appliance.sensor.callable import Callable 20 | -------------------------------------------------------------------------------- /home/appliance/sensor/alarm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import Appliance as Parent 8 | from home.appliance.sensor.alarm import state 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | >>> import home 14 | >>> a = home.appliance.sensor.alarm.Appliance("an alarm", []) 15 | >>> str(a) 16 | 'Appliance an alarm in Unarmed (computed from events: home.event.alarm.armed.Event.Off, home.event.alarm.triggered.Event.Off) and disabled events set()' 17 | """ 18 | 19 | def _init_state(self): 20 | return state.unarmed.State() 21 | -------------------------------------------------------------------------------- /home/appliance/sensor/alarm/state/armed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.alarm.state.armed import callable 8 | from home.appliance.sensor.alarm.state.armed.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/alarm/state/armed/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Unarmed(Callable): 12 | def run(self, event, state): 13 | if ( 14 | home.event.alarm.armed.Event.Off == event 15 | and home.event.alarm.triggered.Event.On not in state 16 | ): 17 | state = self.get_new_state(state, "unarmed") 18 | return state 19 | 20 | 21 | class Triggered(Callable): 22 | def run(self, event, state): 23 | if home.event.alarm.triggered.Event.On == event: 24 | state = self.get_new_state(state, "triggered") 25 | return state 26 | -------------------------------------------------------------------------------- /home/appliance/sensor/alarm/state/triggered/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.alarm.state.triggered import callable 8 | from home.appliance.sensor.alarm.state.triggered.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/alarm/state/triggered/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Armed(Callable): 12 | def run(self, event, state): 13 | if home.event.alarm.armed.Event.Off == event: 14 | state = self.get_new_state(state, "unarmed") 15 | return state 16 | 17 | 18 | class Triggered(Callable): 19 | def run(self, event, state): 20 | if home.event.alarm.triggered.Event.Off == event: 21 | if home.event.alarm.armed.Event.On in state: 22 | state = self.get_new_state(state, "armed") 23 | else: 24 | state = self.get_new_state(state, "unarmed") 25 | return state 26 | -------------------------------------------------------------------------------- /home/appliance/sensor/alarm/state/unarmed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.alarm.state.unarmed import callable 8 | from home.appliance.sensor.alarm.state.unarmed.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/alarm/state/unarmed/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Armed(Callable): 12 | def run(self, event, state): 13 | if home.event.alarm.armed.Event.On == event: 14 | if home.event.alarm.triggered.Event.On not in state: 15 | state = self.get_new_state(state, "armed") 16 | else: 17 | state = self.get_new_state(state, "triggered") 18 | return state 19 | 20 | 21 | class Triggered(Callable): 22 | def run(self, event, state): 23 | return state 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/anemometer/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.anemometer.state import State 8 | from home.appliance import Appliance as Parent 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | A Wind sensor. 14 | 15 | Has just one state with an always changing wind value expressed in wsp. 16 | 17 | >>> import home 18 | >>> a = home.appliance.sensor.anemometer.Appliance("wind sensor", []) 19 | >>> old, new = a.notify(4.5) 20 | >>> old.compute() 21 | '0.0 wsp' 22 | >>> new.compute() 23 | '4.5 wsp' 24 | """ 25 | 26 | def _init_state(self): 27 | return State() 28 | -------------------------------------------------------------------------------- /home/appliance/sensor/anemometer/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.state import State as Parent 8 | 9 | 10 | class State(Parent): 11 | """ 12 | >>> import home 13 | >>> state = home.appliance.sensor.anemometer.State(0.0) 14 | >>> state.compute() 15 | '0.0 wsp' 16 | """ 17 | 18 | DEFAULTS = [ 19 | 0.0, 20 | ] 21 | 22 | def _get_str_value(self): 23 | return "{} wsp".format(self.value) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/callable/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.callable import Callable as Parent 8 | 9 | 10 | class Callable(Parent): 11 | def run(self, event, state): 12 | return state 13 | -------------------------------------------------------------------------------- /home/appliance/sensor/crepuscular/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import Appliance as Parent 8 | from home.appliance.sensor.crepuscular.state import State 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | >>> import home 14 | >>> a = home.appliance.sensor.crepuscular.Appliance("a meter", []) 15 | >>> str(a) 16 | 'Appliance a meter in 0.0 lux (computed from events: 0.0) and disabled events set()' 17 | """ 18 | 19 | def _init_state(self): 20 | return State() 21 | -------------------------------------------------------------------------------- /home/appliance/sensor/crepuscular/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.state import State as Parent 8 | 9 | 10 | class State(Parent): 11 | """ 12 | >>> import home 13 | >>> state = home.appliance.sensor.crepuscular.State(0.0) 14 | >>> state.compute() 15 | '0.0 lux' 16 | """ 17 | 18 | DEFAULTS = [ 19 | 0.0, 20 | ] 21 | 22 | def _get_str_value(self): 23 | return "{} lux".format(self.value) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/luxmeter/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import Appliance as Parent 8 | from home.appliance.sensor.luxmeter.state import State 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | A Lux sensor. 14 | 15 | Has just one state with an always changing lux value expressed in lux. 16 | 17 | >>> import home 18 | >>> l = home.appliance.sensor.luxmeter.Appliance("lux sensor", []) 19 | >>> old, new = l.notify(6000.0) 20 | >>> old.compute() 21 | '0.0 lux' 22 | >>> new.compute() 23 | '6000.0 lux' 24 | """ 25 | 26 | def _init_state(self): 27 | return State() 28 | -------------------------------------------------------------------------------- /home/appliance/sensor/luxmeter/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.crepuscular import State as Parent 8 | 9 | 10 | class State(Parent): 11 | """ 12 | >>> import home 13 | >>> state = home.appliance.sensor.luxmeter.State(0.0) 14 | >>> state.compute() 15 | '0.0 lux' 16 | """ 17 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import Appliance as Parent 8 | from home.appliance.sensor.motion import state 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | >>> import home 14 | >>> a = home.appliance.sensor.motion.Appliance("a motion sensor", []) 15 | >>> str(a) 16 | 'Appliance a motion sensor in Missed (computed from events: home.event.motion.Event.Missed) and disabled events set()' 17 | """ 18 | 19 | def _init_state(self): 20 | return state.missed.State() 21 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home import event 8 | from home.appliance.sensor.state import State as Parent 9 | 10 | 11 | class State(Parent): 12 | """ 13 | >>> import home 14 | >>> state = home.appliance.sensor.motion.state.missed.State() 15 | >>> state.compute() 16 | 'Missed' 17 | >>> state = state.next(home.event.motion.Event.Spotted) 18 | >>> state.compute() 19 | 'Spotted' 20 | """ 21 | 22 | DEFAULTS = [event.motion.Event.Missed] 23 | 24 | 25 | from home.appliance.sensor.motion.state import missed 26 | from home.appliance.sensor.motion.state import spotted 27 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/state/missed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.motion.state.missed import callable 8 | from home.appliance.sensor.motion.state.missed.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/state/missed/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Motion(Callable): 12 | def run(self, event, state): 13 | if home.event.motion.Event.Spotted == event: 14 | state = self.get_new_state(state, "spotted") 15 | return state 16 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/state/missed/state.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.sensor.motion.state import State as Parent 9 | from home.appliance.sensor.motion.state.missed import callable as missed_callable 10 | 11 | 12 | class State(Parent): 13 | 14 | VALUE = "Missed" 15 | 16 | def init_callables(self): 17 | callables = { 18 | type(home.event.motion.Event.Missed): missed_callable.Motion( 19 | spotted=home.appliance.sensor.motion.state.spotted.State 20 | ) 21 | } 22 | 23 | self._callables.update(callables) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/state/spotted/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.motion.state.spotted import callable 8 | from home.appliance.sensor.motion.state.spotted.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/state/spotted/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Motion(Callable): 12 | def run(self, event, state): 13 | if home.event.motion.Event.Missed == event: 14 | state = self.get_new_state(state, "missed") 15 | return state 16 | -------------------------------------------------------------------------------- /home/appliance/sensor/motion/state/spotted/state.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.sensor.motion.state import State as Parent 9 | from home.appliance.sensor.motion.state.spotted import callable as spotted_callable 10 | 11 | 12 | class State(Parent): 13 | 14 | VALUE = "Spotted" 15 | 16 | def init_callables(self): 17 | callables = { 18 | type(home.event.motion.Event.Missed): spotted_callable.Motion( 19 | missed=home.appliance.sensor.motion.state.missed.State 20 | ) 21 | } 22 | 23 | self._callables.update(callables) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/powermeter/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import Appliance as Parent 8 | from home.appliance.sensor.powermeter.state import State 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | >>> import home 14 | >>> a = home.appliance.sensor.powermeter.Appliance("a meter", []) 15 | >>> str(a) 16 | 'Appliance a meter in 0.0 W (computed from events: 0.0) and disabled events set()' 17 | """ 18 | 19 | def _init_state(self): 20 | return State() 21 | -------------------------------------------------------------------------------- /home/appliance/sensor/powermeter/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.state import State as Parent 8 | 9 | 10 | class State(Parent): 11 | """ 12 | >>> import home 13 | >>> state = home.appliance.sensor.powermeter.State(0.0) 14 | >>> state.compute() 15 | '0.0 W' 16 | """ 17 | 18 | DEFAULTS = [ 19 | 0.0, 20 | ] 21 | 22 | def _get_str_value(self): 23 | return "{} W".format(self.value) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import Appliance as Parent 8 | from home.appliance.sensor.rainmeter import state 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | >>> import home 14 | >>> a = home.appliance.sensor.rainmeter.Appliance("a meter", []) 15 | >>> str(a) 16 | 'Appliance a meter in Not raining (computed from events: home.event.rain.Event.No) and disabled events set()' 17 | """ 18 | 19 | def _init_state(self): 20 | return state.no.State() 21 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home import event 8 | from home.appliance.sensor.state import State as Parent 9 | 10 | 11 | class State(Parent): 12 | """ 13 | >>> import home 14 | >>> state = home.appliance.sensor.rainmeter.state.no.State() 15 | >>> state.compute() 16 | 'Not raining' 17 | >>> state = state.next(home.event.rain.Event.Gentle) 18 | >>> state.compute() 19 | 'Gentle raining' 20 | """ 21 | 22 | DEFAULTS = [event.rain.Event.No] 23 | 24 | 25 | from home.appliance.sensor.rainmeter.state import gentle 26 | from home.appliance.sensor.rainmeter.state import no 27 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/state/gentle/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.rainmeter.state.gentle import callable 8 | from home.appliance.sensor.rainmeter.state.gentle.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/state/gentle/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Rain(Callable): 12 | def run(self, event, state): 13 | if home.event.rain.Event.No == event: 14 | state = self.get_new_state(state, "no") 15 | return state 16 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/state/gentle/state.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.sensor.rainmeter.state import State as Parent 9 | from home.appliance.sensor.rainmeter.state.gentle import callable as gentle_callable 10 | 11 | 12 | class State(Parent): 13 | 14 | VALUE = "Gentle raining" 15 | 16 | def init_callables(self): 17 | callables = { 18 | type(home.event.rain.Event.No): gentle_callable.Rain( 19 | no=home.appliance.sensor.rainmeter.state.no.State 20 | ) 21 | } 22 | 23 | self._callables.update(callables) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/state/no/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.rainmeter.state.no import callable 8 | from home.appliance.sensor.rainmeter.state.no.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/state/no/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Rain(Callable): 12 | def run(self, event, state): 13 | if home.event.rain.Event.Gentle == event: 14 | state = self.get_new_state(state, "gentle") 15 | return state 16 | -------------------------------------------------------------------------------- /home/appliance/sensor/rainmeter/state/no/state.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.sensor.rainmeter.state import State as Parent 9 | from home.appliance.sensor.rainmeter.state.no import callable as no_callable 10 | 11 | 12 | class State(Parent): 13 | 14 | VALUE = "Not raining" 15 | 16 | def init_callables(self): 17 | callables = { 18 | type(home.event.rain.Event.No): no_callable.Rain( 19 | gentle=home.appliance.sensor.rainmeter.state.gentle.State 20 | ) 21 | } 22 | 23 | self._callables.update(callables) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/scene/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home import event 8 | from home.appliance.sensor.state import State as Parent 9 | 10 | 11 | class State(Parent): 12 | """ 13 | >>> import home 14 | >>> state = home.appliance.sensor.scene.state.untriggered.State() 15 | >>> state.compute() 16 | 'Untriggered' 17 | >>> state = state.next(home.event.scene.Event.Triggered) 18 | >>> state.compute() 19 | 'Triggered' 20 | """ 21 | 22 | DEFAULTS = [event.scene.Event.Untriggered] 23 | 24 | 25 | from home.appliance.sensor.scene.state import triggered 26 | from home.appliance.sensor.scene.state import untriggered 27 | -------------------------------------------------------------------------------- /home/appliance/sensor/scene/state/triggered/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.scene.state.triggered import callable 8 | from home.appliance.sensor.scene.state.triggered.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/scene/state/triggered/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Scene(Callable): 12 | def run(self, event, state): 13 | if home.event.scene.Event.Untriggered == event: 14 | state = self.get_new_state(state, "untriggered") 15 | return state 16 | -------------------------------------------------------------------------------- /home/appliance/sensor/scene/state/triggered/state.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.sensor.scene.state import State as Parent 9 | from home.appliance.sensor.scene.state.triggered import callable as triggered_callable 10 | 11 | 12 | class State(Parent): 13 | 14 | VALUE = "Triggered" 15 | 16 | def init_callables(self): 17 | callables = { 18 | type(home.event.scene.Event.Untriggered): triggered_callable.Scene( 19 | untriggered=home.appliance.sensor.scene.state.untriggered.State 20 | ) 21 | } 22 | 23 | self._callables.update(callables) 24 | -------------------------------------------------------------------------------- /home/appliance/sensor/scene/state/untriggered/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.scene.state.untriggered import callable 8 | from home.appliance.sensor.scene.state.untriggered.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sensor/scene/state/untriggered/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Scene(Callable): 12 | def run(self, event, state): 13 | if home.event.scene.Event.Triggered == event: 14 | state = self.get_new_state(state, "triggered") 15 | return state 16 | -------------------------------------------------------------------------------- /home/appliance/sensor/scene/state/untriggered/state.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.sensor.scene.state import State as Parent 9 | from home.appliance.sensor.scene.state.untriggered import ( 10 | callable as untriggered_callable, 11 | ) 12 | 13 | 14 | class State(Parent): 15 | 16 | VALUE = "Untriggered" 17 | 18 | def init_callables(self): 19 | callables = { 20 | type(home.event.scene.Event.Untriggered): untriggered_callable.Scene( 21 | triggered=home.appliance.sensor.scene.state.triggered.State 22 | ) 23 | } 24 | 25 | self._callables.update(callables) 26 | -------------------------------------------------------------------------------- /home/appliance/sensor/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.callable import Callable 8 | from home.appliance.state import State as Parent 9 | 10 | 11 | class State(Parent): 12 | def force(self, state_str): 13 | return self 14 | 15 | def unforce(self): 16 | return self 17 | 18 | def init_callables(self): 19 | callables = {self.DEFAULTS[0]: Callable()} 20 | self._callables.update(callables) 21 | 22 | @property 23 | def forced_str(self): 24 | return None 25 | 26 | @property 27 | def forced_enum(self): 28 | return [] 29 | 30 | @property 31 | def value(self): 32 | return self._events[type(self.DEFAULTS[0])] 33 | -------------------------------------------------------------------------------- /home/appliance/sensor/thermometer/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.thermometer.state import State 8 | from home.appliance import Appliance as Parent 9 | 10 | 11 | class Appliance(Parent): 12 | """ 13 | >>> import home 14 | >>> a = home.appliance.sensor.thermometer.Appliance("a meter", []) 15 | >>> str(a) 16 | 'Appliance a meter in 0.0 centigrade (computed from events: 0.0) and disabled events set()' 17 | """ 18 | 19 | def _init_state(self): 20 | return State() 21 | -------------------------------------------------------------------------------- /home/appliance/sensor/thermometer/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sensor.state import State as Parent 8 | 9 | 10 | class State(Parent): 11 | """ 12 | >>> import home 13 | >>> state = home.appliance.sensor.thermometer.State(0.0) 14 | >>> state.compute() 15 | '0.0 centigrade' 16 | """ 17 | 18 | DEFAULTS = [ 19 | 0.0, 20 | ] 21 | 22 | def _get_str_value(self): 23 | return "{} centigrade".format(self.value) 24 | -------------------------------------------------------------------------------- /home/appliance/socket/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket import event 8 | from home.appliance.socket import energy_guard 9 | from home.appliance.socket import presence 10 | -------------------------------------------------------------------------------- /home/appliance/socket/energy_guard/state/detachable/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.energy_guard.state.detachable import callable 8 | from home.appliance.socket.energy_guard.state.detachable.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/energy_guard/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.energy_guard.state.forced import off 8 | from home.appliance.socket.energy_guard.state.forced import on 9 | -------------------------------------------------------------------------------- /home/appliance/socket/energy_guard/state/forced/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.energy_guard.state.forced.off import callable 8 | from home.appliance.socket.energy_guard.state.forced.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/energy_guard/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.energy_guard.state.forced.on import callable 8 | from home.appliance.socket.energy_guard.state.forced.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/energy_guard/state/forced/on/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Power(callable.Callable): 11 | """ 12 | A Power event will not automatically unlock a Forced Socket 13 | """ 14 | 15 | def run(self, event, state): 16 | return state 17 | 18 | 19 | class Duration(Power): 20 | pass 21 | 22 | 23 | class Enable(callable.Forced): 24 | pass 25 | 26 | 27 | class Forced(callable.Callable): 28 | def run(self, event, state): 29 | if event in (state.forced_enum.Not, state.forced_enum.Off): 30 | state = self.compute_new_state(state, "base", [event]) 31 | return state 32 | -------------------------------------------------------------------------------- /home/appliance/socket/energy_guard/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.energy_guard.state.off import callable 8 | from home.appliance.socket.energy_guard.state.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/energy_guard/state/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.energy_guard.state.on import callable 8 | from home.appliance.socket.energy_guard.state.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/event/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.event import forced 8 | -------------------------------------------------------------------------------- /home/appliance/socket/event/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.event.forced.event import Event 8 | -------------------------------------------------------------------------------- /home/appliance/socket/event/forced/event.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | 9 | 10 | class Event(home.event.Enum): 11 | On = "On" 12 | Off = "Off" 13 | Not = "Not" 14 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/christmas/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.christmas.state.forced import off 8 | from home.appliance.socket.presence.christmas.state.forced import on 9 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/christmas/state/forced/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.christmas.state.forced.off import callable 8 | from home.appliance.socket.presence.christmas.state.forced.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/christmas/state/forced/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Presence(callable.Forced): 11 | pass 12 | 13 | 14 | class Christmas(callable.Forced): 15 | pass 16 | 17 | 18 | class SanSilvester(callable.Forced): 19 | pass 20 | 21 | 22 | class Epiphany(callable.Forced): 23 | pass 24 | 25 | 26 | class SunBrightness(callable.Forced): 27 | pass 28 | 29 | 30 | class Forced(callable.Callable): 31 | def run(self, event, state): 32 | if event in (state.forced_enum.Not, state.forced_enum.On): 33 | state = self.compute_new_state(state, "base", [event]) 34 | return state 35 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/christmas/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.christmas.state.forced.on import callable 8 | from home.appliance.socket.presence.christmas.state.forced.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/christmas/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.christmas.state.off import callable 8 | from home.appliance.socket.presence.christmas.state.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/christmas/state/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.christmas.state.on import callable 8 | from home.appliance.socket.presence.christmas.state.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.state.forced import on 8 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.state.forced.on import callable 8 | from home.appliance.socket.presence.state.forced.on.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/state/forced/on/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance import callable 9 | 10 | 11 | class Presence(callable.Callable): 12 | def run(self, event, state): 13 | if event == home.event.presence.Event.Off: 14 | state = self.compute_new_state(state, "base", [state.forced_enum.On]) 15 | return state 16 | 17 | 18 | class Forced(callable.Callable): 19 | def run(self, event, state): 20 | if event in (state.forced_enum.Not, state.forced_enum.Off): 21 | state = self.compute_new_state(state, "base", [event]) 22 | return state 23 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.socket.presence.state.off import callable 8 | from home.appliance.socket.presence.state.off.state import State, Mixin 9 | -------------------------------------------------------------------------------- /home/appliance/socket/presence/state/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.callable import Callable 8 | 9 | 10 | class Presence(Callable): 11 | def run(self, event, state): 12 | return state 13 | 14 | 15 | class Forced(Callable): 16 | def run(self, event, state): 17 | if event == state.forced_enum.On: 18 | state = self.get_new_state(state, "forced_on") 19 | elif event != state.forced_enum.Not: 20 | state = state.unforce() 21 | return state 22 | -------------------------------------------------------------------------------- /home/appliance/sound/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound import player 8 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event import ( 8 | volume, 9 | sleepy_volume, 10 | playlist, 11 | forced, 12 | fade_in, 13 | fade_out, 14 | ) 15 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/fade_in/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.fade_in import playlist, volume 8 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/fade_in/playlist.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.playlist import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on playlist for fade in state 13 | 14 | >>> Event("a wonderful playlist") 15 | Fade in playlist: a wonderful playlist 16 | """ 17 | 18 | def __init__(self, value: str): 19 | super(Event, self).__init__(value) 20 | self._str = "Fade in playlist: {}" 21 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/fade_in/volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.volume import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on fade in volume 13 | 14 | >>> Event(80) 15 | Fade in volume: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._value = value % 101 21 | self._str = "Fade in volume: {}%" 22 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/fade_out/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.fade_out import playlist, volume 8 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/fade_out/playlist.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.playlist import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on playlist for fade out state 13 | 14 | >>> Event("a wonderful playlist") 15 | Fade out playlist: a wonderful playlist 16 | """ 17 | 18 | def __init__(self, value: str): 19 | super(Event, self).__init__(value) 20 | self._str = "Fade out playlist: {}" 21 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/fade_out/volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.volume import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on fade out volume 13 | 14 | >>> Event(80) 15 | Fade out volume: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._value = value % 101 21 | self._str = "Fade out volume: {}%" 22 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.forced.event import Event 8 | from home.appliance.sound.player.event.forced import circadian_rhythm 9 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/forced/circadian_rhythm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.forced.circadian_rhythm import ( 8 | playlist_a, 9 | playlist_b, 10 | playlist_c, 11 | ) 12 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/forced/circadian_rhythm/playlist_a.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.playlist import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying playlist for user A 13 | 14 | >>> Event("a wonderful playlist") 15 | Playlist for user A: a wonderful playlist 16 | """ 17 | 18 | def __init__(self, value: str): 19 | super(Event, self).__init__(value) 20 | self._str = "Playlist for user A: {}" 21 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/forced/circadian_rhythm/playlist_b.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.playlist import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying playlist for user B 13 | 14 | >>> Event("a wonderful playlist") 15 | Playlist for user B: a wonderful playlist 16 | """ 17 | 18 | def __init__(self, value: str): 19 | super(Event, self).__init__(value) 20 | self._str = "Playlist for user B: {}" 21 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/forced/circadian_rhythm/playlist_c.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.playlist import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying playlist for user C 13 | 14 | >>> Event("a wonderful playlist") 15 | Playlist for user C: a wonderful playlist 16 | """ 17 | 18 | def __init__(self, value: str): 19 | super(Event, self).__init__(value) 20 | self._str = "Playlist for user C: {}" 21 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/forced/event.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | 9 | 10 | class Event(home.event.Enum): 11 | On = "On" 12 | Off = "Off" 13 | CircadianRhythm = "CircadianRhythm" 14 | Not = "Not" 15 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/playlist.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Str 8 | 9 | 10 | class Event(Str): 11 | """ 12 | An event carrying a playlist 13 | 14 | >>> Event("a wonderful playlist") 15 | Playlist: a wonderful playlist 16 | """ 17 | 18 | def __init__(self, value: str): 19 | super(Event, self).__init__(value) 20 | self._str = "Playlist: {}" 21 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/sleepy_volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.volume import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on sleepy mood volume 13 | 14 | >>> Event(80) 15 | Sleepy mood Volume: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._value = value % 101 21 | self._str = "Sleepy mood Volume: {}%" 22 | -------------------------------------------------------------------------------- /home/appliance/sound/player/event/volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Int 8 | 9 | 10 | class Event(Int): 11 | """ 12 | An event carrying on sound player volume 13 | 14 | >>> Event(80) 15 | Volume: 80% 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._value = value % 101 21 | self._str = "Volume: {}%" 22 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/fade_in/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.fade_in import callable 8 | from home.appliance.sound.player.state.fade_in.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/fade_out/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.fade_out import callable 8 | from home.appliance.sound.player.state.fade_out.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/fade_out/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.callable import Callable 8 | from home.appliance.sound.player.state.fade_in import callable as fade_in 9 | 10 | 11 | class Elapsed(fade_in.Elapsed): 12 | pass 13 | 14 | 15 | class Presence(fade_in.Presence): 16 | pass 17 | 18 | 19 | class Forced(Callable): 20 | """ 21 | A fading out state starts always from a forced state; when someone un-force the state 22 | it wants that the sound player exits from the fading out state too. 23 | """ 24 | 25 | def run(self, event, state): 26 | if event in (state.forced_enum.Not, state.forced_enum.Off): 27 | state = self.compute_new_state(state, "base", [event]) 28 | return state 29 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.forced import on, off, circadian_rhythm 8 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/forced/circadian_rhythm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.forced.circadian_rhythm import callable 8 | from home.appliance.sound.player.state.forced.circadian_rhythm.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/forced/circadian_rhythm/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.sound.player.state.forced.on import callable as forced_on 9 | from home.appliance.callable import Callable 10 | 11 | 12 | class Sleepiness(Callable): 13 | def run(self, event, state): 14 | if home.event.presence.Event.On in state: 15 | if event == home.event.sleepiness.Event.Asleep: 16 | state = self.compute_new_state( 17 | state, "fade_out", [state.forced_enum.CircadianRhythm] 18 | ) 19 | return state 20 | 21 | 22 | class Presence(forced_on.Presence): 23 | pass 24 | 25 | 26 | class Forced(forced_on.Forced): 27 | pass 28 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/forced/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.forced.off import callable 8 | from home.appliance.sound.player.state.forced.off.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/forced/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.forced.on import callable as forced_on 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class Presence(forced_on.Presence): 12 | pass 13 | 14 | 15 | class Forced(Callable): 16 | def run(self, event, state): 17 | if event == state.forced_enum.Not: 18 | state = self.compute_new_state(state, "base", [event]) 19 | if event == state.forced_enum.On: 20 | state = self.get_new_state(state, "forced_on") 21 | if event == state.forced_enum.CircadianRhythm: 22 | state = self.get_new_state(state, "forced_circadian_rhythm") 23 | return state 24 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.forced.on import callable 8 | from home.appliance.sound.player.state.forced.on.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sound/player/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.state.off import callable 8 | from home.appliance.sound.player.state.off.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/event/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.event import duration, forced, partially_on 8 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/event/duration.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Int 8 | 9 | 10 | class Event(Int): 11 | """ 12 | An event carrying on sprinkling duration 13 | 14 | >>> Event(80) 15 | "Duration: 80 seconds" 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Duration: {} seconds" 21 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/event/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.event.forced.event import Event 8 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/event/forced/event.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | 9 | 10 | class Event(home.event.Enum): 11 | On = "On" 12 | PartiallyOn = "PartiallyOn" 13 | Off = "Off" 14 | Not = "Not" 15 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/event/partially_on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.event.partially_on import duration 8 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/event/partially_on/duration.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.event.duration import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on partially on sprinkling duration 13 | 14 | >>> Event(80) 15 | Partially on duration: 80 seconds 16 | """ 17 | 18 | def __init__(self, value: int): 19 | super(Event, self).__init__(value) 20 | self._str = "Partially on duration: {} seconds" 21 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.forced import on, off, partially_on 8 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/forced/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.forced.off import callable 8 | from home.appliance.sprinkler.state.forced.off.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/forced/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.forced.on import callable as forced_on 8 | from home.appliance.callable import Callable 9 | 10 | 11 | class SunPhase(forced_on.SunPhase): 12 | pass 13 | 14 | 15 | class Forced(Callable): 16 | def run(self, event, state): 17 | if event in (state.forced_enum.Not, state.forced_enum.Off): 18 | state = self.compute_new_state(state, "base", [event]) 19 | if event == state.forced_enum.On: 20 | state = self.get_new_state(state, "forced_on") 21 | if event == state.forced_enum.PartiallyOn: 22 | state = self.get_new_state(state, "forced_partially_on") 23 | return state 24 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.forced.on import callable 8 | from home.appliance.sprinkler.state.forced.on.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/forced/on/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | from home.appliance.callable import Callable, Forced as Parent 9 | 10 | 11 | class SunPhase(Parent): 12 | def run(self, event, state): 13 | if event == home.event.sun.phase.Event.Sunset: 14 | return state 15 | else: 16 | return super(SunPhase, self).run(event, state) 17 | 18 | 19 | class Forced(Callable): 20 | def run(self, event, state): 21 | if event in (state.forced_enum.Not, state.forced_enum.Off): 22 | state = self.compute_new_state(state, "base", [event]) 23 | return state 24 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/forced/partially_on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.forced.partially_on import callable 8 | from home.appliance.sprinkler.state.forced.partially_on.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/forced/partially_on/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.forced.on import callable as forced_on 8 | 9 | 10 | class SunPhase(forced_on.SunPhase): 11 | pass 12 | 13 | 14 | class Forced(forced_on.Forced): 15 | pass 16 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.off import callable 8 | from home.appliance.sprinkler.state.off.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.on import callable 8 | from home.appliance.sprinkler.state.on.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/sprinkler/state/partially_on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.state.partially_on import callable 8 | from home.appliance.sprinkler.state.partially_on.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/thermostat/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat import presence 8 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/event/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.event import setpoint 8 | from home.appliance.thermostat.presence.event import forced 9 | from home.appliance.thermostat.presence.event import keep 10 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/event/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.event.forced.event import Event 8 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/event/forced/event.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import home 8 | 9 | 10 | class Event(home.event.Enum): 11 | Off = "Off" 12 | On = "On" 13 | Keep = "Keep" 14 | Not = "Not" 15 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/event/keep/__init__.py: -------------------------------------------------------------------------------- 1 | from home.appliance.thermostat.presence.event.keep import setpoint 2 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/event/keep/setpoint.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.event.setpoint import Event as Parent 8 | 9 | 10 | class Event(Parent): 11 | """ 12 | An event carrying on setpoint data in keeping mode 13 | 14 | >>> Event(40.5) 15 | Keeping mode setpoint: 40.5° 16 | """ 17 | 18 | def __init__(self, value: float): 19 | super(Event, self).__init__(value) 20 | self._str = "Keeping mode setpoint: {}°" 21 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/event/setpoint.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.event import Float 8 | 9 | 10 | class Event(Float): 11 | """ 12 | An event carrying on setpoint data 13 | 14 | >>> Event(40.5) 15 | Setpoint: 40.5° 16 | """ 17 | 18 | def __init__(self, value: float): 19 | super(Event, self).__init__(value) 20 | self._setpoint = value % 50 21 | self._str = "Setpoint: {}°" 22 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/forced/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.state.forced import on 8 | from home.appliance.thermostat.presence.state.forced import off 9 | from home.appliance.thermostat.presence.state.forced import keep 10 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/forced/keep/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.state.forced.keep import callable 8 | from home.appliance.thermostat.presence.state.forced.keep.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/forced/keep/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Presence(callable.Forced): 11 | pass 12 | 13 | 14 | class Command(callable.Forced): 15 | pass 16 | 17 | 18 | class Forced(callable.Callable): 19 | def run(self, event, state): 20 | if event == state.forced_enum.On: 21 | state = self.get_new_state(state, "forced_on") 22 | elif event == state.forced_enum.Off: 23 | state = self.get_new_state(state, "forced_off") 24 | elif event == state.forced_enum.Not: 25 | state = self.compute_new_state(state, "base", [event]) 26 | return state 27 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/forced/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.state.forced.off import callable 8 | from home.appliance.thermostat.presence.state.forced.off.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/forced/off/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Presence(callable.Forced): 11 | pass 12 | 13 | 14 | class Command(callable.Forced): 15 | pass 16 | 17 | 18 | class Forced(callable.Callable): 19 | def run(self, event, state): 20 | if event == state.forced_enum.On: 21 | state = self.get_new_state(state, "forced_on") 22 | elif event == state.forced_enum.Keep: 23 | state = self.get_new_state(state, "forced_keep") 24 | elif event == state.forced_enum.Not: 25 | state = self.compute_new_state(state, "base", [event]) 26 | return state 27 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/forced/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.state.forced.on import callable 8 | from home.appliance.thermostat.presence.state.forced.on.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/forced/on/callable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance import callable 8 | 9 | 10 | class Presence(callable.Forced): 11 | pass 12 | 13 | 14 | class Command(callable.Forced): 15 | pass 16 | 17 | 18 | class Forced(callable.Callable): 19 | def run(self, event, state): 20 | if event == state.forced_enum.Off: 21 | state = self.get_new_state(state, "forced_off") 22 | elif event == state.forced_enum.Keep: 23 | state = self.get_new_state(state, "forced_keep") 24 | elif event == state.forced_enum.Not: 25 | state = self.compute_new_state(state, "base", [event]) 26 | return state 27 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/keep/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.state.keep import callable 8 | from home.appliance.thermostat.presence.state.keep.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/off/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.state.off import callable 8 | from home.appliance.thermostat.presence.state.off.state import State 9 | -------------------------------------------------------------------------------- /home/appliance/thermostat/presence/state/on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.state.on import callable 8 | from home.appliance.thermostat.presence.state.on.state import State 9 | -------------------------------------------------------------------------------- /home/builder/listener/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.listener.resources import MyHome, Builder, Resources, OnRedisMsg 8 | -------------------------------------------------------------------------------- /home/builder/scheduler/__init__.py: -------------------------------------------------------------------------------- 1 | from home.builder.scheduler import trigger 2 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/circadian_rhythm.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger import Builder as Parent 8 | from home.scheduler.trigger.circadian_rhythm import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | """ 13 | >>> import home 14 | >>> map ={ 15 | ... "name": "adjust saturation during the day: bagno", 16 | ... "events": [], 17 | ... "events_in_a_day": [home.appliance.light.event.circadian_rhythm.saturation.Event(0)]} 18 | >>> l = home.builder.scheduler.trigger.circadian_rhythm.Builder()._run(map, []) 19 | >>> len(l) 20 | 1 21 | """ 22 | 23 | TAG_NAME = "circadian_rhythm.Trigger" 24 | 25 | @property 26 | def trigger(self): 27 | return Trigger 28 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/crawler/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.crawler import osmer_fvg 8 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/crawler/osmer_fvg/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.crawler.osmer_fvg import will_rain 8 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/crawler/osmer_fvg/will_rain/on.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.crawler.osmer_fvg.will_rain import Builder as Parent 8 | from home.scheduler.trigger.crawler.osmer_fvg.will_rain.on import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "crawler.osmer_fvg.will_rain.on.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/date/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger import Builder as Parent 8 | from home.scheduler.trigger.date import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "date.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | 18 | def _get_kwargs(self, mapping): 19 | run_date = mapping["run_date"] 20 | timezone = mapping["timezone"] if "timezone" in mapping else None 21 | return {"run_date": run_date, "timezone": timezone} 22 | 23 | def _run(self, mapping, group_of_performers): 24 | kwargs = self._get_kwargs(mapping) 25 | return [self.trigger(**kwargs)] 26 | 27 | 28 | from home.builder.scheduler.trigger.date import resettable 29 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/date/resettable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.date import Builder as Parent 8 | from home.scheduler.trigger.date.resettable import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "date.resettable.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | 18 | def _get_kwargs(self, mapping): 19 | kwargs = super(Builder, self)._get_kwargs(mapping) 20 | kwargs["resettable events"] = mapping["resettable events"] 21 | return kwargs 22 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/protocol/mean/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.protocol.mean import greater_than 8 | from home.builder.scheduler.trigger.protocol.mean import lesser_than 9 | from home.builder.scheduler.trigger.protocol.mean import in_between 10 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/protocol/mean/greater_than.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.protocol import Builder as Parent 8 | from home.scheduler.trigger.protocol.mean import GreaterThan 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "protocol.mean.GreaterThan" 13 | 14 | @property 15 | def trigger(self): 16 | return GreaterThan 17 | 18 | def _build_kwargs(self, mapping): 19 | d = super(Builder, self)._build_kwargs(mapping) 20 | num_of_samples = int(mapping["num of samples"]) 21 | hit_value = float(mapping["hit value"]) 22 | timeout_seconds = float(mapping["timeout seconds"]) 23 | d["num_of_samples"] = num_of_samples 24 | d["hit_value"] = hit_value 25 | d["timeout_seconds"] = timeout_seconds 26 | return d 27 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/protocol/mean/lesser_than.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.protocol.mean.greater_than import Builder as Parent 8 | from home.scheduler.trigger.protocol.mean import LesserThan 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "protocol.mean.LesserThan" 13 | 14 | @property 15 | def trigger(self): 16 | return LesserThan 17 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/state/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from typing import List, Any 8 | from home.builder.scheduler.trigger import Builder as Parent 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "state.Trigger" 13 | 14 | def _build_args(self, mapping) -> List[Any]: 15 | name = mapping["name"] 16 | events = mapping["notify events"] 17 | state = mapping["when appliance is"] 18 | return [name, events, state] 19 | 20 | def _run(self, mapping, group_of_performers): 21 | args = self._build_args(mapping) 22 | return [self.trigger(*args)] 23 | 24 | 25 | from home.builder.scheduler.trigger.state import entering, exiting 26 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/state/delay.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.state import Builder as Parent 8 | from home.scheduler.trigger.state.delay import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "state.delay.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | 18 | def _build_args(self, mapping): 19 | args = super(Builder, self)._build_args(mapping) 20 | args.append(mapping["and timeout expires"]) 21 | return args 22 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/state/entering/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.state import Builder as Parent 8 | from home.scheduler.trigger.state.entering import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "state.entering.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | 18 | def _build_args(self, mapping): 19 | name = mapping["name"] 20 | events = mapping["notify events"] 21 | state = mapping["when appliance state became"] 22 | return [name, events, state] 23 | 24 | 25 | from home.builder.scheduler.trigger.state.entering import delay 26 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/state/exiting/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.state import Builder as Parent 8 | from home.scheduler.trigger.state.exiting import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "state.exiting.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | 18 | def _build_args(self, mapping): 19 | name = mapping["name"] 20 | events = mapping["notify events"] 21 | state = mapping["when appliance state is no more"] 22 | return [name, events, state] 23 | 24 | 25 | from home.builder.scheduler.trigger.state.exiting import delay 26 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/sunleft.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun import Builder as Parent 8 | from home.scheduler.trigger.sun.sunleft import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "sun.sunleft.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | 18 | def _build_args(self, mapping): 19 | args = super(Builder, self)._build_args(mapping) 20 | position = mapping["position"] 21 | args.append(position) 22 | return args 23 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/sunrise.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun import Builder as Parent 8 | from home.scheduler.trigger.sun.sunrise import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "sun.sunrise.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/sunset.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun import Builder as Parent 8 | from home.scheduler.trigger.sun.sunset import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "sun.sunset.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/twilight/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun.twilight import civil 8 | from home.builder.scheduler.trigger.sun.twilight import astronomical 9 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/twilight/astronomical/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun.twilight.astronomical import sunrise 8 | from home.builder.scheduler.trigger.sun.twilight.astronomical import sunset 9 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/twilight/astronomical/sunrise.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun import Builder as Parent 8 | from home.scheduler.trigger.sun.twilight.astronomical.sunrise import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "sun.twilight.astronomical.sunrise.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/twilight/astronomical/sunset.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun import Builder as Parent 8 | from home.scheduler.trigger.sun.twilight.astronomical.sunset import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "sun.twilight.astronomical.sunset.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/twilight/civil/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun.twilight.civil import sunrise 8 | from home.builder.scheduler.trigger.sun.twilight.civil import sunset 9 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/twilight/civil/sunrise.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun import Builder as Parent 8 | from home.scheduler.trigger.sun.twilight.civil.sunrise import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "sun.twilight.civil.sunrise.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | -------------------------------------------------------------------------------- /home/builder/scheduler/trigger/sun/twilight/civil/sunset.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.builder.scheduler.trigger.sun import Builder as Parent 8 | from home.scheduler.trigger.sun.twilight.civil.sunset import Trigger 9 | 10 | 11 | class Builder(Parent): 12 | TAG_NAME = "sun.twilight.civil.sunset.Trigger" 13 | 14 | @property 15 | def trigger(self): 16 | return Trigger 17 | -------------------------------------------------------------------------------- /home/event/alarm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.alarm import triggered, armed 8 | -------------------------------------------------------------------------------- /home/event/alarm/armed.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/alarm/triggered.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/clima/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.clima import command 8 | from home.event.clima import season 9 | -------------------------------------------------------------------------------- /home/event/clima/command.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | Keep = "Keep" 14 | -------------------------------------------------------------------------------- /home/event/clima/season.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Winter = "Winter" 12 | Spring = "Spring" 13 | Summer = "Summer" 14 | Fall = "Fall" 15 | -------------------------------------------------------------------------------- /home/event/courtesy.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/elapsed.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/enable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/holiday/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Vacation = "Vacation" 12 | Over = "Over" 13 | 14 | 15 | from home.event.holiday import christmas 16 | from home.event.holiday import easter 17 | from home.event.holiday import epiphany 18 | from home.event.holiday import san_silvester 19 | -------------------------------------------------------------------------------- /home/event/holiday/christmas.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Day = "Day" 12 | Eve = "Eve" 13 | Time = "Time" 14 | Over = "Over" 15 | -------------------------------------------------------------------------------- /home/event/holiday/definition.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | -------------------------------------------------------------------------------- /home/event/holiday/easter.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Day = "Day" 12 | Eve = "Eve" 13 | Over = "Over" 14 | -------------------------------------------------------------------------------- /home/event/holiday/epiphany.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Day = "Day" 12 | Eve = "Eve" 13 | Over = "Over" 14 | -------------------------------------------------------------------------------- /home/event/holiday/san_silvester.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Day = "Day" 12 | Eve = "Eve" 13 | Over = "Over" 14 | -------------------------------------------------------------------------------- /home/event/motion.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Spotted = "Spotted" 12 | Missed = "Missed" 13 | -------------------------------------------------------------------------------- /home/event/power/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.power import consumption 8 | from home.event.power import production 9 | -------------------------------------------------------------------------------- /home/event/power/consumption/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | No = "No" 12 | Low = "Low" 13 | High = "High" 14 | 15 | 16 | from home.event.power.consumption import duration 17 | -------------------------------------------------------------------------------- /home/event/power/consumption/duration.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Short = "Short" 12 | Long = "Long" 13 | -------------------------------------------------------------------------------- /home/event/power/production/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | No = "No" 12 | Low = "Low" 13 | High = "High" 14 | 15 | 16 | from home.event.power.production import duration 17 | -------------------------------------------------------------------------------- /home/event/power/production/duration.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Short = "Short" 12 | Long = "Long" 13 | -------------------------------------------------------------------------------- /home/event/presence.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/rain/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | No = "No" 12 | Mist = "Mist" 13 | Gentle = "Gentle" 14 | Heavy = "Heavy" 15 | Storm = "Storm" 16 | 17 | 18 | from home.event.rain import forecast, in_the_past 19 | -------------------------------------------------------------------------------- /home/event/rain/forecast.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/rain/in_the_past.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/scene.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Triggered = "Triggered" 12 | Untriggered = "Untriggered" 13 | -------------------------------------------------------------------------------- /home/event/show.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/sleepiness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Asleep = "Asleep" 12 | Awake = "Awake" 13 | Sleepy = "Sleepy" 14 | -------------------------------------------------------------------------------- /home/event/sun/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.sun import hit 8 | from home.event.sun import phase 9 | from home.event.sun import twilight 10 | from home.event.sun import brightness 11 | -------------------------------------------------------------------------------- /home/event/sun/brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Bright = "Bright" 12 | Dark = "Dark" 13 | DeepDark = "DeepDark" 14 | -------------------------------------------------------------------------------- /home/event/sun/hit.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Sunhit = "Sunhit" 12 | Sunleft = "Sunleft" 13 | -------------------------------------------------------------------------------- /home/event/sun/phase.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Sunset = "Sunset" 12 | Sunrise = "Sunrise" 13 | -------------------------------------------------------------------------------- /home/event/sun/twilight/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.sun.twilight import civil 8 | from home.event.sun.twilight import astronomical 9 | -------------------------------------------------------------------------------- /home/event/sun/twilight/astronomical.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Sunset = "Sunset" 12 | Sunrise = "Sunrise" 13 | -------------------------------------------------------------------------------- /home/event/sun/twilight/civil.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Sunset = "Sunset" 12 | Sunrise = "Sunrise" 13 | -------------------------------------------------------------------------------- /home/event/temperature.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Hot = "Hot" 12 | Warm = "Warm" 13 | Cold = "Cold" 14 | -------------------------------------------------------------------------------- /home/event/toggle.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | On = "On" 12 | Off = "Off" 13 | -------------------------------------------------------------------------------- /home/event/user.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | A = "A" 12 | B = "B" 13 | C = "C" 14 | -------------------------------------------------------------------------------- /home/event/waveform.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Saw = "Saw" 12 | Sine = "Sine" 13 | HalfSine = "HalfSine" 14 | Triangle = "Triangle" 15 | Pulse = "Pulse" 16 | -------------------------------------------------------------------------------- /home/event/wind.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.event.enumeration import Enum 8 | 9 | 10 | class Event(Enum): 11 | Strong = "Strong" 12 | Weak = "Weak" 13 | -------------------------------------------------------------------------------- /home/example.ini: -------------------------------------------------------------------------------- 1 | [project] 2 | project_dir = /path/to/yaml 3 | logging_dir = /tmp 4 | logging_level = WARNING 5 | redis_host = localhost 6 | redis_port = 6379 7 | my_node_name = brain 8 | other_nodes_names = ws, graphite 9 | 10 | [home_assistant] 11 | host = 172.31.10.236 12 | port = 8123 13 | token = HA_TOKEN 14 | logging_level = INFO 15 | 16 | [knx_usbhid] 17 | logging_level = INFO 18 | daemon_host = 172.31.11.251 19 | daemon_port = 5555 20 | 21 | #[knxnet_ip] 22 | #logging_level = INFO 23 | #server_host = localhost 24 | #server_port = 3761 25 | #client_host = localhost 26 | #client_port = 1736 27 | #client_nat_host = localhost 28 | #client_nat_port = 1736 29 | 30 | [lifx] 31 | logging_level = INFO 32 | 33 | [sonos] 34 | logging_level = INFO 35 | 36 | [somfy_sdn] 37 | logging_level = INFO 38 | device = /dev/tty.usbmodemfd121 -------------------------------------------------------------------------------- /home/features/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/home/features/__init__.py -------------------------------------------------------------------------------- /home/features/steps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/home/features/steps/__init__.py -------------------------------------------------------------------------------- /home/protocol/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.protocol import message 8 | from home.protocol.gateway import Gateway, WrongMsg 9 | from home.protocol.message import Description, Command, Trigger, Wait 10 | from home.protocol import mean 11 | -------------------------------------------------------------------------------- /home/protocol/mean.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from abc import abstractmethod 8 | 9 | 10 | class Mixin: 11 | @abstractmethod 12 | def get_value(self, description: "home.protocol.Description") -> float: 13 | ... 14 | -------------------------------------------------------------------------------- /home/redis/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis import gateway 8 | from home.redis.gateway import Gateway 9 | -------------------------------------------------------------------------------- /home/redis/gateway/client/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.client import appliance 8 | from home.redis.gateway.client import performer 9 | from home.redis.gateway.client import pubsub 10 | from home.redis.gateway.client import storage 11 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization import ( 8 | enumeration, 9 | brightness, 10 | hue, 11 | saturation, 12 | temperature, 13 | sleepy_volume, 14 | volume, 15 | playlist, 16 | circadian_rhythm, 17 | lux_balancing, 18 | show, 19 | fade_in, 20 | fade_out, 21 | partially_on, 22 | keep, 23 | ) 24 | from home.redis.gateway.serialization.decoder import Decoder 25 | from home.redis.gateway.serialization.encoder import Encoder 26 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.brightness import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.brightness.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.circadian_rhythm import hue 8 | from home.redis.gateway.serialization.circadian_rhythm import brightness 9 | from home.redis.gateway.serialization.circadian_rhythm import saturation 10 | from home.redis.gateway.serialization.circadian_rhythm import temperature 11 | from home.redis.gateway.serialization.circadian_rhythm import playlist_a 12 | from home.redis.gateway.serialization.circadian_rhythm import playlist_b 13 | from home.redis.gateway.serialization.circadian_rhythm import playlist_c 14 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.circadian_rhythm.brightness import Event 8 | from home.redis.gateway.serialization.brightness import Deserializer as DParent 9 | from home.redis.gateway.serialization.brightness import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.circadian_rhythm.brightness.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.circadian_rhythm.hue import Event 8 | from home.redis.gateway.serialization.hue import Deserializer as DParent 9 | from home.redis.gateway.serialization.hue import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.circadian_rhythm.hue.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/playlist_a.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.forced.circadian_rhythm.playlist_a import Event 8 | from home.redis.gateway.serialization.playlist import Deserializer as DParent 9 | from home.redis.gateway.serialization.playlist import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.forced.circadian_rhythm.playlist_a.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/playlist_b.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.forced.circadian_rhythm.playlist_b import Event 8 | from home.redis.gateway.serialization.playlist import Deserializer as DParent 9 | from home.redis.gateway.serialization.playlist import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.forced.circadian_rhythm.playlist_b.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/playlist_c.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.forced.circadian_rhythm.playlist_c import Event 8 | from home.redis.gateway.serialization.playlist import Deserializer as DParent 9 | from home.redis.gateway.serialization.playlist import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.forced.circadian_rhythm.playlist_c.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.circadian_rhythm.saturation import Event 8 | from home.redis.gateway.serialization.saturation import Deserializer as DParent 9 | from home.redis.gateway.serialization.saturation import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.circadian_rhythm.saturation.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/circadian_rhythm/temperature.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.circadian_rhythm.temperature import Event 8 | from home.redis.gateway.serialization.temperature import Deserializer as DParent 9 | from home.redis.gateway.serialization.temperature import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.circadian_rhythm.temperature.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/deserializer.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import abc 8 | 9 | 10 | class Deserializer: 11 | def __init__(self, *args, **kwargs): 12 | pass 13 | 14 | @abc.abstractmethod 15 | def check(self, serialization): 16 | ... 17 | 18 | @abc.abstractmethod 19 | def run(self, serialization): 20 | ... 21 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/duration.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.event.duration import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.sprinkler.event.duration.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/event.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/home/redis/gateway/serialization/event.py -------------------------------------------------------------------------------- /home/redis/gateway/serialization/event/float.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.event import Deserializer as Parent 8 | 9 | 10 | class Deserializer(Parent): 11 | def run(self, serialization): 12 | return self.klass(float(serialization[self.key])) 13 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/event/int.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.event import Deserializer as Parent 8 | 9 | 10 | class Deserializer(Parent): 11 | def run(self, serialization): 12 | return self.klass(int(serialization[self.key])) 13 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/event/str.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.event import Deserializer as Parent 8 | 9 | 10 | class Deserializer(Parent): 11 | def run(self, serialization): 12 | return self.klass(str(serialization[self.key])) 13 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/fade_in/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.fade_in import playlist, volume 8 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/fade_in/playlist.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.fade_in.playlist import Event 8 | from home.redis.gateway.serialization.playlist import Deserializer as DParent 9 | from home.redis.gateway.serialization.playlist import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.fade_in.playlist.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/fade_in/volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.fade_in.volume import Event 8 | from home.redis.gateway.serialization.volume import Deserializer as DParent 9 | from home.redis.gateway.serialization.volume import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.fade_in.volume.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/fade_out/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.fade_out import playlist, volume 8 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/fade_out/playlist.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.fade_out.playlist import Event 8 | from home.redis.gateway.serialization.playlist import Deserializer as DParent 9 | from home.redis.gateway.serialization.playlist import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.fade_out.playlist.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/fade_out/volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.fade_out.volume import Event 8 | from home.redis.gateway.serialization.volume import Deserializer as DParent 9 | from home.redis.gateway.serialization.volume import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.fade_out.volume.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.hue import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.hue.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/keep/__init__.py: -------------------------------------------------------------------------------- 1 | from home.redis.gateway.serialization.keep import setpoint 2 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/keep/setpoint.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.event.keep.setpoint import Event 8 | from home.redis.gateway.serialization.setpoint import Deserializer as DParent 9 | from home.redis.gateway.serialization.setpoint import Serializer as SParent 10 | 11 | KEY = "home.appliance.thermostat.presence.event.keep.setpoint.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/lux_balancing/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.lux_balancing import brightness 8 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/lux_balancing/brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.lux_balancing.brightness import Event 8 | from home.redis.gateway.serialization.brightness import Deserializer as DParent 9 | from home.redis.gateway.serialization.brightness import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.lux_balancing.brightness.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/partially_on/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.partially_on import duration 8 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/partially_on/duration.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sprinkler.event.partially_on.duration import Event 8 | from home.redis.gateway.serialization.duration import Deserializer as DParent 9 | from home.redis.gateway.serialization.duration import Serializer as SParent 10 | 11 | KEY = "home.appliance.sprinkler.event.partially_on.duration.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/playlist.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.playlist import Event 8 | from home.redis.gateway.serialization.event.str import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.playlist.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.saturation import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.saturation.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/serializer.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import abc 8 | 9 | 10 | class Serializer: 11 | def __init__(self, *args, **kwargs): 12 | pass 13 | 14 | @abc.abstractmethod 15 | def run(self, obj): 16 | ... 17 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/setpoint.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.thermostat.presence.event.setpoint import Event 8 | from home.redis.gateway.serialization.event.float import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.thermostat.presence.event.setpoint.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.redis.gateway.serialization.show import cycles 8 | from home.redis.gateway.serialization.show import period 9 | from home.redis.gateway.serialization.show import ending_brightness 10 | from home.redis.gateway.serialization.show import starting_brightness 11 | from home.redis.gateway.serialization.show import starting_hue 12 | from home.redis.gateway.serialization.show import starting_saturation 13 | from home.redis.gateway.serialization.show import ending_hue 14 | from home.redis.gateway.serialization.show import ending_saturation 15 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/cycles.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.cycles import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.cycles.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/ending_brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.ending_brightness import Event 8 | from home.redis.gateway.serialization.brightness import Deserializer as DParent 9 | from home.redis.gateway.serialization.brightness import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.ending_brightness.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/ending_hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.ending_hue import Event 8 | from home.redis.gateway.serialization.hue import Deserializer as DParent 9 | from home.redis.gateway.serialization.hue import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.ending_hue.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/ending_saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.ending_saturation import Event 8 | from home.redis.gateway.serialization.hue import Deserializer as DParent 9 | from home.redis.gateway.serialization.hue import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.ending_saturation.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/period.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.period import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.period.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/starting_brightness.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.starting_brightness import Event 8 | from home.redis.gateway.serialization.brightness import Deserializer as DParent 9 | from home.redis.gateway.serialization.brightness import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.starting_brightness.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/starting_hue.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.starting_hue import Event 8 | from home.redis.gateway.serialization.hue import Deserializer as DParent 9 | from home.redis.gateway.serialization.hue import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.starting_hue.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/show/starting_saturation.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.show.starting_saturation import Event 8 | from home.redis.gateway.serialization.hue import Deserializer as DParent 9 | from home.redis.gateway.serialization.hue import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.show.starting_saturation.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/sleepy_volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.sleepy_volume import Event 8 | from home.redis.gateway.serialization.volume import Deserializer as DParent 9 | from home.redis.gateway.serialization.volume import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.sleepy_volume.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/temperature.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.light.event.temperature import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.light.event.temperature.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/redis/gateway/serialization/volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.appliance.sound.player.event.volume import Event 8 | from home.redis.gateway.serialization.event.int import Deserializer as DParent 9 | from home.redis.gateway.serialization.event import Serializer as SParent 10 | 11 | KEY = "home.appliance.sound.player.event.volume.Event" 12 | 13 | 14 | class Serializer(SParent): 15 | @property 16 | def key(self): 17 | return KEY 18 | 19 | 20 | class Deserializer(DParent): 21 | @property 22 | def key(self): 23 | return KEY 24 | 25 | @property 26 | def klass(self): 27 | return Event 28 | -------------------------------------------------------------------------------- /home/scheduler/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.scheduler import trigger 8 | from home.scheduler.trigger import Trigger 9 | -------------------------------------------------------------------------------- /home/scheduler/trigger/crawler/__init__.py: -------------------------------------------------------------------------------- 1 | from home.scheduler.trigger.crawler import osmer_fvg 2 | -------------------------------------------------------------------------------- /home/scheduler/trigger/crawler/osmer_fvg/will_rain/__init__.py: -------------------------------------------------------------------------------- 1 | from home.scheduler.trigger.crawler.osmer_fvg.will_rain import on 2 | from home.scheduler.trigger.crawler.osmer_fvg.will_rain import off 3 | -------------------------------------------------------------------------------- /home/scheduler/trigger/cron.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from apscheduler.triggers.cron import CronTrigger 8 | from home.scheduler.trigger import Trigger as Parent 9 | 10 | from typing import List 11 | 12 | 13 | class Trigger(Parent, CronTrigger): 14 | """ 15 | An extension of the `APScheduler CronTrigger `_. 16 | """ 17 | 18 | def __init__(self, name: str, events: List["home.Event"], *args, **kwargs): 19 | super(Trigger, self).__init__(name, events, *args, **kwargs) 20 | -------------------------------------------------------------------------------- /home/scheduler/trigger/date/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from apscheduler.triggers.date import DateTrigger 8 | from home.scheduler.trigger import Trigger as Parent 9 | 10 | from typing import Iterable 11 | 12 | 13 | class Trigger(Parent, DateTrigger): 14 | """ 15 | An extension of the `APScheduler DateTrigger `_. 16 | """ 17 | 18 | def __init__(self, name: str, events: Iterable["home.Event"], *args, **kwargs): 19 | super(Trigger, self).__init__(name, events, *args, **kwargs) 20 | 21 | 22 | from home.scheduler.trigger.date import resettable 23 | -------------------------------------------------------------------------------- /home/scheduler/trigger/date/resettable.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | import logging 8 | 9 | from apscheduler.triggers.date import DateTrigger 10 | from home.scheduler.trigger import Trigger as Parent 11 | 12 | 13 | class Trigger(Parent, DateTrigger): 14 | """A date trigger which events could be disabled by someone else.""" 15 | 16 | def __init__(self, name, events, run_date, *args, **kwargs): 17 | super(Trigger, self).__init__(name, events, run_date, *args, **kwargs) 18 | self._logger = logging.getLogger(__name__) 19 | self._is_enabled = True 20 | 21 | @property 22 | def is_enabled(self): 23 | return self._is_enabled 24 | 25 | def disable(self): 26 | self._is_enabled = False 27 | -------------------------------------------------------------------------------- /home/scheduler/trigger/interval.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from apscheduler.triggers.interval import IntervalTrigger 8 | from home.scheduler.trigger import Trigger as Parent 9 | 10 | from typing import Iterable 11 | 12 | 13 | class Trigger(Parent, IntervalTrigger): 14 | """ 15 | An extension of the `APScheduler IntervalTrigger `_. 16 | """ 17 | 18 | def __init__(self, name: str, events: Iterable["home.Event"], *args, **kwargs): 19 | super(Trigger, self).__init__(name, events, *args, **kwargs) 20 | -------------------------------------------------------------------------------- /home/scheduler/trigger/sun/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.scheduler.trigger.sun import sunhit 8 | from home.scheduler.trigger.sun import sunleft 9 | from home.scheduler.trigger.sun import sunrise 10 | from home.scheduler.trigger.sun import sunset 11 | from home.scheduler.trigger.sun import twilight 12 | from home.scheduler.trigger.sun.position import Position 13 | -------------------------------------------------------------------------------- /home/scheduler/trigger/sun/twilight/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.scheduler.trigger.sun.twilight import civil, astronomical 8 | -------------------------------------------------------------------------------- /home/scheduler/trigger/sun/twilight/astronomical/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.scheduler.trigger.sun.twilight.astronomical import sunrise 8 | from home.scheduler.trigger.sun.twilight.astronomical import sunset 9 | -------------------------------------------------------------------------------- /home/scheduler/trigger/sun/twilight/civil/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.scheduler.trigger.sun.twilight.civil import sunrise 8 | from home.scheduler.trigger.sun.twilight.civil import sunset 9 | -------------------------------------------------------------------------------- /home/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.tests import builder 8 | -------------------------------------------------------------------------------- /home/tests/builder/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # automate home devices 4 | # 5 | # Copyright (C) 2021 Maja Massarini 6 | 7 | from home.tests.builder import test_helper 8 | from home.tests.builder import test_performers 9 | -------------------------------------------------------------------------------- /home/tests/redis/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/home/tests/redis/__init__.py -------------------------------------------------------------------------------- /icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majamassarini/automate-home/0038caaf31b0a187a7251f0702d15be03341a808/icon_128x128.png -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | behave 2 | flake8 3 | black -------------------------------------------------------------------------------- /requirements-doc.txt: -------------------------------------------------------------------------------- 1 | sphinx-gherkindoc 2 | sphinx-rtd-theme -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | APScheduler 2 | aioredis==1.3.1 3 | hiredis==1.1.0 4 | ephem 5 | pytz 6 | PyYAML 7 | --------------------------------------------------------------------------------