Code Monkey home page Code Monkey logo

iot-hub-c's People

Contributors

mposzywak avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

iot-hub-c's Issues

Handle setTilt() while executed during tilt move

If the arduino receives the shadeTILT command (or physical button gets pressed) while the tilt movement is in progress, the new tilt value will be recorded as the desiredTilt, but the tilt movement will finish based on the old desiredTilt. This will result in different tilt value obseved on the shade and in the applications.

Uneven movement back

When the shade is directed downwards from HA (while being in fully open), and then while it is moving down the slider is set towards fully open (because its position won't change until the movement is complete), and then fully closed - the shade movement changes direction to upwards. When the shade stops it is stopped slightly lower then the maximum position. (It should go its maximum up position). This effect accumulates when repeated multiple times.

Add press-and-hold light switch option

Add a light type device that would turn on the digitOUT device on condition where the input pin is on and stays on, once it is released the digitOUT device is turned off.

Temperature 1-wire sensor as digitout

Implement new temperature sensor over 1-wire with the support for DS18B20 chip.

  • The device type should be switchable through ARiF.
  • Temperature sending interval should be settable through ARiF. Default interval hardcoded - 60s.

missing ARiF commands

Need to add the following ARiF commands:
modeLights - set the VelenHub mode to Lights
modeShades - set the VelenHub mode to Shades
shadeTTimer - set individual shade Tilt Timer (in miliseconds)
shadePTimer - set individual shade Position timer (in seconds)

individual shades' timers must be held in EEPROM.

No need for tilt move when the shade is fully open

When the shade is fully open (i. e. when it is at the top - position 0) The tilt move will still happen if it is half-closed or closed. This movement is not necessary and hence doesn't need to happen. The tilt status however still should be sent in case the tilt command has been received while the shade is moving towards position 0.

ARiF settings commands

Add commands to the ARiF that will report the settings of the Arduino and various devices:

  • modeLights - indicates that the Arduino is set to Lights mode
  • modeShades - indicates that the Arduino is set to Shades mode
  • inputHold - indicates that the light input is of type Hold (i. e. switch)
  • inputRelease - indicates that the light input is of type Release (i. e. button)
  • ctrlON - indicates that the Arduino has central ON turned on
  • ctrlOFF - indicates that the Arduino has central ON turned off
  • lightType - indicates the type of the light (i. e. 0 - regular on/off device, 1 - timer based device)
  • lightTimer - indicates the timer set on the device, should only be sent when the light type is set to timer.

Improve shade physical button behavior

The button should work in the following way:

  1. If pressed for less then 2 seconds, it should move the shade until released. This to be used to set the tilt. If the tilt has changed due to such movement, tilt status must be sent.
    2.If pressed for more than 2 seconds, it should start movement until either open or closed.

Switch to Ethernet3 library

We could use Ethernet3 library for the following improvements:

  1. void remoteMAC() could be added to save the Raspy's MAC address and do not allow any communication with any other MAC. This would prevent raspy spoofing, and ARP spoofing MITMs.

Other ideas can be added.

Tilt update after tilt command

After the device receive tilt command it should send the tilt status message to the raspy in order to update the state.

Port code to Arduino Mega2560

This code should be ported in order to work with Arduino Mega2560. Porting should have the following features:

  1. Common sections in the the code for different platforms, ideally if possible in cpp/h file pair.
  2. There shouldn't be any manual code changes needed to compile the code for a given platform. (no lines needed to be commented out, etc.)

OTA implementation

Implement possibility to update the code through Ethernet. Could be done based on:
https://github.com/jandrassy/ArduinoOTA

The following requirements should be considered:

  1. First the firmware should be downloaded and verified before any code is substituted.
  2. Upgrade should be done over LAN or possibly over internet (if no raspy present in the LAN).
  3. If upgraded over LAN, it shouldn't rely on Arduino SDK it should be a generic method of providing the firmware to the device that is to be upgraded.

basic REST API - phase 1

This should create a REST API for reading only information about the devices (shades and lights) and some of the configuration settings that are global.

Shade can be stopped while in sync move

Currently after power outage the shade must be manually moved up or down to sync. During that sync move the shade can be stopped with physical button and after stopping the tilt can be adjusted. This results in different states being reported in the node/home-assistant apps.

While the shade sync move is not finished there should be no possibility to adjust the tilt with physical buttons (this way it could be an indicator that the shade is in unsynced state)

Static webpage with system state [phase 1]

Add a static web page on port 80 that would list various states of the system:

  • registration status (registered/not-registered, connected/not-connected, ardID, raspyID, raspy IP)
  • devices state:
    • shades: devID, position, tilt, sync, movement-range, tilt-range etc..
    • lights: devID, status
  • other system data: temperature, uptime, etc..

Physical pin for central shades open/close

The pin should be reserved as last one in the row (highest number) and there are the following options:

  1. The pin should always close all shades regardless of their current state. Tilt should also be closed.
  2. The pin should close all shades if at least one of them is open. Tils should also be closed. If all the shades (and tilt) are closed, then pin should open all of them (including tilt)

New Shade type - w/o tilt

Implementation of shade typing (the existing shade implementation should be of type 0). New type 1 will not have tilt control, only position move. ARiF commands need to be added to switch between shade types.

Allow position change while tilt movement is ongoing

Currently there is unpredictable results when position change command comes to arduino while the tilt movement is ongoing. The preferred scenario would be that the once the change position command comes to the arduino while the tilt movement is running, the tilt movement should be finished uninterupted and after a short brake (300ms as per the direction change timer) the position movement would start to the desired position.

allow remote shade configuration

The following settings related shades should be configurable remotely - using a specific ARiF command:

  1. Shade movement range (configurable in seconds)
  2. Shade tilt movement range (configurable in miliseconds)

Simple Heat device implementation

The Simple Heat device shall be composed of one input and one output type, hence it can be a type of digitOUT class.

By default initially its input pin will work as a press-hold to control the digitOUT state.

The Simple Heat device shall have a flag that will shift the control between the input pin or the ARiF. The Heat device can be controlled either by the thermostat connected to the input pins or the raspy.

Initial phase will only work based on the input pin state and two ARiF command:

heatON
heatOFF

the heat device state is not stored in the EEPROM, only the device type and its settings:

device type: SIMPLE_HVAC
override flag: true/false

There will be an override flag implemented to indicate if the output pin is controlled by the raspy or by the input pins:

  1. Override flag set to false:
  • output pin controlled solely based on the input pin.
  • ARiF commands for this device are ignored
  • no change in operation whether the raspy is up or down
  1. Override flag set to true:
  • output pin controlled by the ARiF heatON and heatOFF commands. Default state is the output pin off - in caes raspy is up, but no commands comes from it. The system after boot should wait couple of seconds until raspy connection is recognized, not to start with input pin control and then switch immediately to raspy control once heartbeat starts going.
  • input pin state is ignored
  • if the raspy is detected down after few seconds the device should switch to input pin control
  • if the raspy gets up after heartbeat failure, the system should wait few seconds for the heatON or heatOFF command. in case no command is received it switches the output pin to off.

The override heat flag shall be set by the commands:

overrideON
overrideOFF

Packets sent over ARiF 432 bits

When Arduino sends data to raspy over ARiF the whole HTTP messages is fragmented into 432 bits packets. Probably due to limited window size value.

SD Card storage for HTML files

The HTML files shouldn't be stored directly in the code neither on remote hosting site (as it is done currently). If the SD Card is available, then it should serve as a source for HTML code of the WebGUI. If SD Card is not detected only basic info can be displayed - like Version, small debug info etc..

Cleanup of the stop() function

Everything that is currently done by:

setTiltFromUp();
setTiltFromDown();
tiltStop();

should be done throught:

stop()

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.