Giter VIP home page Giter VIP logo

iot_control's Issues

add auto-off functionality to iotraspigpio

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.