Git Product home page Git Product logo

hr20-esp12-master's People

Contributors

hrochmic avatar volca02 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hr20-esp12-master's Issues

Add a web based JSON interface (for REST)

This would be usable to upload timers in one payload, list clients, get client values... Could make a nice web page using REST that would render most of the things client-side.

Base work on RFM69 modules

RFM12 modules are getting more difficult to find.

Basing this project on a RFM69 module used in RFM12-compatible mode would be preferred.

Porting the whole OpenHR20 to RFM69 to reduce power consumption and increase range would be even better, but it involves a lot more work and it's beyond the scope of this project.

Cannot Build

I tried to Build the project with PlatformIO.
Builf failed, many errors in webserver.cc.

Dop you have tried a build on actual Version of plaformio ?

Simplify mqtt subscriptions

Do a bulk subscription to /prefix/# at the start (in setup()), and avoid any by-hand subscriptions later on. Simplifies the code and adds the ability to pre-set mqtt values without needing to see the client first.

Implement EEPROM mirroring

This is a low priority feature, but may be a useful one. 32 bytes of plain byte array and 2 32bit integers to persist read/write state of the bytes. Custom code to sync them up. Would use G/S commands to get data to/from clients.

Implement a better WEB interface

Currently there is a really lousy web interface present. JSON urls can be used for javascript code to get data from the master as needed, so the way would probably be a small html with inline css and js, doing requests for client lists/timers/error lists/... Might implement value setting later, but for now monitoring webpage is enough.

Re-sync NTP in regular intervals

We will face time drift issues without re-syncing NTP once in a while. It should be as easy as remembering last sync time, but we should preferably do this while RFM radio is off to avoid interference. If there are no force flags in the particular minute, we can do it after :30 sync packet is sent.

Process client feedback in case of problematic sets

Short debug responses are indication of invalid set values in case of 'A' command. Implement a on_temperature method that processes debug responses with invalid byte counts by reseting the requested temperature and issuing an error.

Rewrite mqtt publishing code to use a state machine

ESP12 seems to like to freeze now if we feed to much output data to mqtt PubSubClient. It goes away if timers are not synced, but the general solution is to use a state machine and update the mqtt broker incrementally piece by piece (Not blocking the main loop for too long).

This could also open the door to a more active mqtt publishing - after triplet of client-master-client packet exchange, there usually is a window to send the updated data to broker before the next second starts. This can easily be made configurable.

Implement persistence

Some values could be persisted in FS and read upon reboot. This would be done for changed values every few hours or so to avoid frequent rewrites. This would mean less chatter with clients for stuff like timers and similar, at the expense of possible undetected differences (topic for another change).

NTP Time synchronization - implement slew

Implement smooth transition for secondary (i.e. after first succesful) NTP synchronizations. Currently the change happens so rapidly clients fall out of sync. Shortening/prolonging seconds at the span of a few minutes would resolve this. Investigate if this is possible.

Drift could also be calculated at the end of each sync, meaning some kind of drift compensation could be implemented.

Detect non-responsive radio

Currently we don't seem to indicate well that radio chip is not connected well. Disconnecting NSEL will cause no error reports to happen for a while until the packet queue fills.

split main.cc, reformat the source code

main.cc is crowded as a friday midnight bus station. Splitting it to a separate pieces is prefferable. Reformatting with the included .clang-format is a good simultaneous step.

Add publish flag to CachedValue

Should be used to only publish values that changed - publish will knock it up, setting new value will knock it down. Should limit the publishes to just the changed values.

Implement an indirection table (allocator) in Model class

We have limited RAM situation, so currently we only support 4 time table entries a day. We could support 8 if we implemented an allocator for clients in model class and limit their count to some lower number than 32 (heck 16 is probably overkill for most households).

Often can't set values via mqtt

Sometimes, the callback is not called after publishing a value to one of the settable topics.

Hopefully the transition to arduino-mqtt #32 solves this, if not, will have to diagnose more.

Implement a MQTT interface

MQTT interface is the next logical step:

Topic base path should be:
/prefix/addr/*

with fixed but customizable prefix (compile time).

Topics:

  • temp
  • temp_wtd
  • battery
  • mode
  • timers/*

Timers then should probably be timers/day/slot/... - need feedback here.

Re-visit interrupt based RFM12 control.

Clashes with SPI.h's dislike for interrupts. Needs reworked state handling. Just the low level byte read/write handling should be handled there, not blocking the interrupts for long.

Add support for reset button

We need a button to reset configuration and bring board back to AP mode. This enables reconfiguration.
Reset button should have these two modes:

  1. short press (2s) resets WiFi only
  2. long press (10s) resets WiFi and set default configuration

Implement an event log

Similary to #23, there could/should be an event log of last N events happening on the master (sort of a space constrained low profile debug log, listing received/sent messages to clients, MQTT activity, etc).

Non-sync packets don't send address

prologue should contain target address for non-sync packets - enlarge it to 6 bytes, add the address there for non-sync packets, and add 1 to length in that case.

Improve MQTT reconnect logic/timing

Currently the ESP master halts to total stop when the mqtt is unreachable. There should be a logic in place to limit the reconnect attempts to once per few seconds.

don't limit sync count

Original master does have a sync count limitation, but it is effectively deactivated by frequent time synces from controlling computer.

NTPClient discards fractional part of time synchronization

This leads to (up to <1s) inaccuracies in the set NTP time, breaking continuity of time and communication with clients.

Preferable fix is to include fractional part of time in the ntp updates (successive bytes to the currently used), and implementing slew #37

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.