Skip to content

Add support for Tahoma smoke sensor, light switch and two awning io components#14931

Closed
fucm wants to merge 17 commits intohome-assistant:devfrom
fucm:tahoma-io
Closed

Add support for Tahoma smoke sensor, light switch and two awning io components#14931
fucm wants to merge 17 commits intohome-assistant:devfrom
fucm:tahoma-io

Conversation

@fucm
Copy link
Copy Markdown
Contributor

@fucm fucm commented Jun 11, 2018

Description:

Add support for 4 Tahoma devices:

  • io:VerticalExteriorAwningIOComponent: a new cover type
  • io:HorizontalAwningIOComponent: a new cover type (just added, because I have them not available for testing - they should behave like the vertical ones)
  • io:OnOffLightIOComponent: light switch
  • rtds:RTDSSmokeSensor: smoke sensor

Additional improvements:

  • added all available state attributes, like battery warning, rssi level, memorised position, lock timer/level/originator.
  • added special icon for the awnings, if they are locked by wind or something else.
  • added special icon for the smoke sensor, if fire is detected or the battery is low.
  • increase sensor update time from 10s to 120s

Related issue (if applicable): fixes #13965

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5590

Example entry for configuration.yaml (if applicable):

nothing

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • No new dependencies.
  • New file already covered by components/*/tahoma.py (.coveragerc).

If the code does not interact with devices:

  • N/A (interacts with devices).

fucm added 6 commits May 24, 2018 22:35
- 'io:VerticalExteriorAwningIOComponent': 'cover'
- 'io:HorizontalAwningIOComponent': 'cover'
- 'io:OnOffLightIOComponent': 'switch'
- 'rtds:RTDSSmokeSensor': 'smoke'
- 'io:VerticalExteriorAwningIOComponent': 'cover'
- 'io:HorizontalAwningIOComponent': 'cover'
- 'io:OnOffLightIOComponent': 'switch'
- 'rtds:RTDSSmokeSensor': 'smoke'
- all: provide available state attributes
- binary_sensor: smoke sensor can show battery warning icon
- sensor: increase sensor update time from 10s to 120s
@homeassistant
Copy link
Copy Markdown
Contributor

Hi @fucm,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

awarecan and others added 3 commits June 12, 2018 07:28
More test cases to cover retry logic added in 58a1c38
…me-assistant#14823)

* start arlo refactoring

* Refactored Arlo Hub to avoid uncessary and duplicated GETs to Arlo API

* Refactored Arlo camera component to avoid duplicate queries

* Added debug and error messages when video is not found

* Transformed Arlo Control Panel to Sync

* Makes linter happy

* Uses total_seconds() for scan_interval

* Added callback and fixed scan_interval issue

* Disable multiple tries and supported custom modes set in Arlo

* Bump PyArlo version to 0.1.4

* Makes lint happy

* Removed ArloHub object and added some tweaks

* Fixed hub_refresh method

* Makes lint happy

* Ajusted async syntax and added callbacks decorators

* Bump PyArlo version to 0.1.6 to include some enhacements

* Refined code
awarecan and others added 6 commits June 12, 2018 09:32
* initial commit for kiwi door locks

bugfixes

improved attribute display

flake8

more style adjustments

* added session handling

flake8

* added requirements_all

reordered imports and flake8

attempt to pelase a very picky linter

also pleasing pylint now :)

* re-try the build

* added kiwi.py to .coveragerc

* reorganized datetime handling and attribute naming

* created pypi package for door lock library

* updated requirements_all.txt

* code review changes

* added async lock state reset for locking state

* refactored lat/lon attribute updates

* initial locked state changed from undefined to locked

* refactored is_locked property check

* handling authentication exception in setup_platform

* added more check in setup_platform

* code review changes: return type in setup_platform

* fixed logging issue

* event handling in main thread

* updated kiwiki-client to version 0.1.1

* renamed alias e to exc
Current uuid is ok when using only 1 snapserver
New uuid is needed when using multiple snapserver

Because the client can connect to more snapservers and
then uuid based on client MAC is not enough
- 'io:VerticalExteriorAwningIOComponent': 'cover'
- 'io:HorizontalAwningIOComponent': 'cover'
- 'io:OnOffLightIOComponent': 'switch'
- 'rtds:RTDSSmokeSensor': 'smoke'
- all: provide available state attributes
- binary_sensor: smoke sensor can show battery warning icon
- sensor: increase sensor update time from 10s to 120s
except KeyError:
return None
if self._position <= 5:
self._position = 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't know. It was there since the beginning (#10652). So, I kept the code.

return None

@property
def state_attributes(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not override state_attributes. Devices can override device_state_attributes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll update it.


_LOGGER = logging.getLogger(__name__)

ATTR_CLOSURE = 'closure'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please limit PRs to 1 feature per PR next time. So changes to binary sensor and cover: 2 prs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do so in the future. Sorry.

attr[ATTR_STATUS] = self.tahoma_device.active_states[
'core:StatusState']
if self._lock_timer is not None:
attr[ATTR_LOCK_TIMER] = self._lock_timer
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should store any times in the state machine. Only time stamps are allowed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the docs about the states again and I don't understand, why the lock timer should go into the state machine. It's an attribute of the device for how long it is locked (before it can be used again, e.g. open cover after wind has been detected). It relates directly to lock_level and lock_originator. Could you please point me to an example or the appropriate documentation?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can store timestamps, so store the exact time when it can be used. Don't store relative times that change on every update.

return bool(self._state == STATE_ON)

@property
def state_attributes(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device_state_attributes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

self.tahoma_device.active_states['core:StatusState']
if 'core:PriorityLockTimerState' in self.tahoma_device.active_states:
attr[ATTR_LOCK_TIMER] = \
self.tahoma_device.active_states['core:PriorityLockTimerState']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same info as the cover?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is the same type of info, but from the switch. Actually I do not know, for what the PriorityLockTimerState is used in case of a switch. For example a cover is blocked by a wind sensor for a certain time, in case of strong wind.

@fucm
Copy link
Copy Markdown
Contributor Author

fucm commented Jun 27, 2018

@balloob is anything open from your review? I don't plan any other changes.

@balloob
Copy link
Copy Markdown
Member

balloob commented Jul 2, 2018

It seems like you have some commits in this branch that are not yours, please clean it up.

@fucm
Copy link
Copy Markdown
Contributor Author

fucm commented Jul 2, 2018

I do not understand where those commits are coming from! My branch looks clean, but the pull request contains the additional commits, which seem to be from other pull requests. Any hint what I could do now? How can I clean it up?

@balloob
Copy link
Copy Markdown
Member

balloob commented Jul 10, 2018

https://xkcd.com/1597/

@fucm
Copy link
Copy Markdown
Contributor Author

fucm commented Jul 13, 2018

I will create smaller pull requests for each component. Closing this pull request.

@fucm fucm closed this Jul 13, 2018
@ghost ghost removed the in progress label Jul 13, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tahoma: Unsupported type of my covers and cover control buttons reversed and stop button not working

8 participants