Skip to content

Conversation

MartinHjelmare
Copy link
Collaborator

@MartinHjelmare MartinHjelmare commented Jun 5, 2016

  • Add method _handle_heartbeat to handle internal message of type
    I_HEARTBEAT_RESPONSE.
  • Add an instance attribute new_state to Sensor class. This attribute
    represents the new state of the dictionary stored in Sensor
    attribute children. The new state is what a controller wants to
    achieve. The children dictionary is only
    updated when I_HEARTBEAT_RESPONSE is received and _handle_heartbeat
    is called.
  • Add attribute queue of type collections.deque in Sensor class. Use
    the deque to store replies for received messages. Add replies to
    queue when heartbeat is received.
  • Fill Gateway.queue in _handle_heartbeat with commands from new_state
    and Sensor.queue. Get tasks from Gateway.queue until it's
    empty in run loop before receiving new messages.
  • Update set_child_value method in Sensor class to handle kwarg
    children. This is used in Gateway method set_child_value to update
    values of new_state Sensor attribute.
  • Update method _handle_internal to redirect message with
    I_HEARTBEAT_RESPONSE to _handle_heartbeat.
  • Update set_child_value in Gateway class, to not fill queue and
    instead update new_state dict if new_state is non empty. It's non
    empty if _handle_heartbeat has been called at least once.
  • Clean up send method in SerialGateway class.
  • Update run methods in SerialGateway and TCPGateway where send method
    is called.
  • Add str and repr magic methods to ChildSensor class.
  • Add tests for heartbeat message.
  • Update tests to handle updated logic method return type.
  • Check protocol version before checking heartbeat internal message.
  • Remove unnecessary log message.
  • Remove unnecessary return statements.
  • Add validation of child values.
  • Fix check of protocol version at Gateway init.

@MartinHjelmare
Copy link
Collaborator Author

Needs testing before merging.

* Add method _handle_heartbeat to handle internal message of type
  I_HEARTBEAT_RESPONSE.
* Add an instance attribute new_state to Sensor class. This attribute
  represents the new state of the dictionary stored in Sensor
  attribute children. The new state is what a controller wants to
  achieve. The children dictionary is only
  updated when I_HEARTBEAT_RESPONSE is received and _handle_heartbeat
  is called.
* Add attribute queue of type collections.deque in Sensor class. Use
  the deque to store replies for received messages. Add replies to
  queue when heartbeat is received.
* Fill Gateway.queue in _handle_heartbeat with commands from new_state
  and Sensor.queue. Get tasks from Gateway.queue until it's
  empty in run loop before receiving new messages.
* Update set_child_value method in Sensor class to handle kwarg
  children. This is used in Gateway method set_child_value to update
  values of new_state Sensor attribute.
* Update method _handle_internal to redirect message with
  I_HEARTBEAT_RESPONSE to _handle_heartbeat.
* Update set_child_value in Gateway class, to not fill queue and
  instead update new_state dict if new_state is non empty. It's non
  empty if _handle_heartbeat has been called at least once.
* Clean up send method in SerialGateway class.
* Update run methods in SerialGateway and TCPGateway where send method
  is called.
* Add str and repr magic methods to ChildSensor class.
* Add tests for heartbeat message.
* Update tests to handle updated logic method return type.
* Check protocol version before checking heartbeat internal message.
* Remove unnecessary log message.
* Remove unnecessary return statements.
* Add validation of child values.
* Fix check of protocol version at Gateway init.
@MartinHjelmare MartinHjelmare merged commit 85be5d9 into theolind:dev Jul 25, 2016
@MartinHjelmare MartinHjelmare deleted the add_smart_sleep branch July 25, 2016 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant