home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.94k stars 29.03k forks source link

Aeotec Minimote is misinterpreted as 3 lights by Home Assistant #2188

Closed realAkhmed closed 8 years ago

realAkhmed commented 8 years ago

Home Assistant release (hass --version): 0.20.2

Python release (python3 --version): 3.4.2

Component/platform: Raspberry Pi 3 Model B

$ uname -a
Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux

Description of problem: Aeotec Minimote is misinterpreted as 3 lights by Home Assistant

Hardware:

Expected:

Minimote should be recognized as a secondary controller

Problem-relevant configuration.yaml entries and steps to reproduce:

The basic configuration.yaml + added zwave clause:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 45.0023
  longitude: -93.2408
  # C for Celsius, F for Fahrenheit
  temperature_unit: C
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/Chicago

# Enables the frontend
frontend:

# Checks for available updates
updater:

# View all events in a logbook
logbook:

# Track the sun
sun:

# Allows you to issue voice commands from the frontend
conversation:

# Show links to resources in log and frontend
introduction:

# Prediction of weather
sensor:
   platform: yr

# Enables support for tracking state changes over time.
history:

# Discover some devices automatically
discovery:

# Z-wave stick
zwave:
  usb_path: /dev/serial/by-id/usb-0658_0200-if00
  1. Plug-in freshly factory-reset Z-stick gen5
  2. Start Home Assistant
  3. In Home Assistant, go to "Services"
  4. Choose "zwave/add_node" and then click "Call Service"
  5. On Minimote, click "Learn" as per instructions for secondary controller
  6. Minimote shows success with long blue light
  7. Home Assistant shows the attached picture with 3 new light services (there are no devices in the network except for minimote and host) minimote-lights
  8. If you go to States, there is one extra light (also visible in Traceback) states-light
  9. When Home Assistant is stopped, zwcfg_xxxx.xml correctly identifies node id=2 as minimote and remote controller. There are only 2 nodes in the xml (attached)
        <Node id="2" name="" location="" basic="1" generic="1" specific="1" type="Portable Remote Controller" listening="false" frequentListening="false" beaming="true" routing="false" max_baud_rate="40000" version="3" query_stage="Complete">
                <Manufacturer id="86" name="Aeotec">
                        <Product type="1" id="3" name="Minimote" />
                </Manufacturer>
...  
  1. When Home Assistant is restarted, the light disappears yet zwcfg_xxxx.xml consistently shows the presence of minimote.
  2. Other devices (smart switches) work fine in Home Assistant so the problem is isolated for Minimote only

Traceback (if applicable):

Below is the traceback of everything that happens right after zwave/add_node is initiated

INFO:homeassistant.core:Bus:Handling <Event call_service[L]: domain=zwave, service_call_id=1979033008-1, service_data=, service=add_node>
/srv/hass/lib/python3.4/site-packages/homeassistant/components/zwave.py:286: DeprecationWarning: Call to deprecated function begin_command_add_device.
  NETWORK.controller.begin_command_add_device()
INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=1979033008-1>
INFO:homeassistant.components.http:"POST /api/services/zwave/add_node HTTP/1.1" 200 -
sys:1: DeprecationWarning: Call to deprecated function zwcallback.
sys:1: DeprecationWarning: Call to deprecated function zwcallback.
INFO:homeassistant.loader:Loaded light from homeassistant.components.light
INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=light, service=turn_on>
INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=light, service=turn_off>
INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=light, service=toggle>
INFO:homeassistant.components.api:Found broken event stream to 192.168.1.6, cleaning up
INFO:homeassistant.components.api:Found broken event stream to 192.168.1.6, cleaning up
INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=light>
INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: discovered=value_id=72057594076299265, node_id=2, service=zwave.light>
INFO:homeassistant.loader:Loaded light.zwave from homeassistant.components.light.zwave
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=light.__level_2, new_state=<state light.__level_2=off; friendly_name=  Level, node_id=2 @ 2016-05-31T20:00:53.178968-05:00>, old_state=None>
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=group.all_lights, new_state=<state group.all_lights=unknown; entity_id=[], order=0, friendly_name=all lights, auto=True, hidden=True @ 2016-05-31T20:00:53.180828-05:00>, old_state=None>
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=group.all_lights, new_state=None, old_state=<state group.all_lights=unknown; entity_id=[], order=0, friendly_name=all lights, auto=True, hidden=True @ 2016-05-31T20:00:53.180828-05:00>>
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=group.all_lights, new_state=<state group.all_lights=off; entity_id=('light.__level_2',), order=0, friendly_name=all lights, auto=True, hidden=True @ 2016-05-31T20:00:53.186059-05:00>, old_state=None>
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594076299265}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594076299288}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594076299304}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594084687920}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594084687937}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594086604801}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594086604816}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594086604832}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594086604854}) on node 2
WARNING:openzwave:Z-Wave Notification ValueRemoved for an unknown value ({'id': 72057594086604870}) on node 2

Additional info:

philhawthorne commented 8 years ago

Hey realAkhmed

I think this is normal behavior. This generally happens when a z-wave device is first linked with Home Assistant. Usually, a generic ID is given to the device. For example, when I link some Aeotec Multisensors, they'll come up as sensor/multisensor1. Once I restart HA, the proper entity ID is given, which is something like binary_sensor/aeotec_multisensor1 sensor/aeotec_multisensor1_temperature and so on...

For more info, see a similar discussion on the forums: https://community.home-assistant.io/t/zwave-entity-names-changing-on-their-own/1476/2

I'm guessing once HA restarts, the light disappears because it is now recognisesd as a remote, and you should then be able to configure it as normal. I'm guessing it won't show in the device list, because it is a remote and not a sensor/switch.

realAkhmed commented 8 years ago

@philhawthorne thanks for your reply! The issue is that once HA restarts there are no remote controls anywhere.

The entity_id page does not have any remote controls so there is no entity_id for the Minimote and it cannot be used for anything (unless I am missing something?)

Basically, minimote only appears inside HA entity_ids for a very brief period (until a restart) and only as a light.

philhawthorne commented 8 years ago

Ah I see what you're saying

https://home-assistant.io/components/zwave/#aeon-minimote

So I'm guessing you can't see any device named like aeon_labs_minimote_1 etc?

realAkhmed commented 8 years ago

Yes, aeon_labs_minimote_1 does not exist in the entity list and so does not work as a trigger.

philhawthorne commented 8 years ago

Damn. Out of curiosity if you click a button on the remote, does an entity appear in HA?

Also, have you tried using Open Zwave Control Panel to see if the device is being recongized in that correctly?

realAkhmed commented 8 years ago

Damn. Out of curiosity if you click a button on the remote, does an entity appear in HA?

Unfortunately, no

Also, have you tried using Open Zwave Control Panel to see if the device is being recongized in that correctly?

Yes, ozwcp recognizes it correctly. Your idea is interesting: it looks like it goes to sleep quite fast. And nothing I do seems to prevent it from moving to "Sleeping": the manual says to hold 'Learn' for 3 seconds -- this does not seem to work.


Update: Solved!

Thanks @philhawthorne! Your advice was perfect: what was needed is to go back to ozwcp and play with it more.

The trick is twofold:

  1. You need to change Minimote from Group Mode to Scene Mode
  2. But the window for making that change is extremely short
    • Minimote is a battery device so goes to sleep in a few seconds.
    • When you pair it with the main controller using ozwcp for the first time you only have a few seconds to click Configuration and switch from Group to Scene.
    • Keep clicking "Learn" on Minimote to wake it up
    • If you miss that window you would end up in the forever "Probe(Sleeping)" or "CacheLoad(Sleeping)" state where the remote would not listen to anything no matter how much you click it
    • If you succeed you would see HA Console popping with events from aeotec_minimote_2 and it will survive multiple restarts.

solution

The rest of configurations in configuration.yaml is just about following the instructions above

automation:
- alias: Minimote Button 1 Pressed
  trigger:
    platform: event
    event_type: zwave.scene_activated
    event_data:
      entity_id: aeotec_minimote_2
      scene_id: 1
  action:
    service: switch.toggle
    entity_id: switch.aeotec_smart_switch_6_switch_3

By the way, HA assistant would still not show any entity_id for Minimote on the "Entities" page. Nevertheless, all the scripts work and the console clearly shows that the events are acting as triggers correctly!

Thanks for the advice again! Took me my whole day off.

philhawthorne commented 8 years ago

@realAkhmed glad I could help! Zwave and OpenZwave can be a bit tricky. I'm still learning myself, but glad you were eventually able to figure this one out!

bbangert commented 7 years ago

Out of curiosity, why was this closed? I haven't seen any documentation added to address this, I needed to google search and finally found this issue (and the fix suggested here worked).

I haven't looked at everything open-zwave emits, but it seems like the steps above should be able to be integrated automatically into HA. Here's what I would expect:

  1. When you run add-device service in HA, it runs as usual
  2. HA emits a 'zwave_node_add' event
  3. HA has a library of special commands/responses to emit for certain devices
  4. HA sees zwave_node_add, and runs appropriate device code to ensure the config for this device is set from Group to Scene.

It's quite likely/possible other devices will need similar things, so having HA automatically do it when adding seems much better than making people Google around for a solution.