As promised, here's my automation framework for .NET Core developers, Puppet!
The README should (hopefully) have everything you need. Here's the basics:
How it works
-
An event on one of your devices is triggered.
Example: Your pantry door opens, triggering a contact sensor to send open.
-
An instance of this app is configured to send a webhook to the Puppet Web app.
Example: The webhook app posts the event containing the open status to
http://some.address.on.my.network:5000/api/automation/?automationName=pantry_door
-
The web app handles the request by passing the event information to the Puppet Executive app, which runs in a separate process that manages task state.
-
The Puppet Executive passes the name of the automation to the
AutomationFactory
. TheAutomationFactory
class instantiates the correct implementation ofIAutomation
and returns it to the Executive.Example: The Executive asks
AutomationFactory
for an object to handle the automation namedpantry_door
. It returns an instance ofPuppet.Automation.PantryLightAutomation
. -
The Executive executes the
Handle()
method on the IAutomation object. The object can manipulate other devices via theHomeAutomationPlatform
class, of which an instance can be passed in by the Executive.
BEST EXAMPLE: The logic in Puppet.Automation.PantryLightAutomation
should be pretty self-explanatory.
Let me know if you have any questions, or send me a PR if you want to make improvements! Also check out my Twitch stuff (listed in the README) to see me working on it.