mkluge / iot_control Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
I'd like to add an auto-off feature. If a raspi GPIO is switched on then it switches itself off after minutes. This should happen locally on the raspi so that the garden doesn't get flooded because the wifi is interrupted or the mqtt broker fails or whatever.
Basically, this is simple with HA MQTT. But if goes against the architecture of iot_control. The 'mqtthass' component doesn't know about the 'iotraspigpio' cpmponent's details and 'iotraspigpio' is not supposed to send MQTT messages.
What would be a clean solution?
Option A: The backends already know the devices. Should the devices get to know the backends as well? And then call them directly? Sounds wrong, doesn't it?
Option B: The device get a pointer to the iotruntime object. And the iotruntime gets a "switch me <on/off> in time" functionality. This could be equivalent to a MQTT message arriving but triggered locally. The time could be in granularity of the iotruntime.update_intervall -- in every loop iteration it checks if anything is due from an ordered list of scheduled events ( == option B1). Or it could use a background thread via Python's threading.Timer ( == option B2).
Which one would you like?
Basically copy the GPIO backend but have it run local shell commands. The commands are configurable in the config file.
currently only reading channel 0
currently names are fix, should be fixed
values change with different light settings, but seem a bit low
maybe calculation is wrong
switch status changes should got into the backends as new values
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.