Conversation
|
kellerza, great work! I am able to at least get the sensor badges up and when I close each channel, the text changes to "True", but does not change to "False" when I open it. On the bit map, 1 = Open and 0 = Closed. Does HA represent Open as True and Closed as False in general? Wouldn't these be considered binary sensors rather? The entity names are shown as sensor.unnamed_device, sensor.unnamed_device_2, sensor.unnamed_device_3 and sensor.unnamed_device_4 instead of the entity names I assigned within the configuration file as below: qwikswitch: Regarding the channels, the channel numbers are not mapped correctly. The channels map as below based on the config above. Can you rather allow the channel numbers to be 1, 2, 3, 4, etc instead of 0, 1, 2, 3, etc? Can you please also correct the mapping? Channel 1 - imod_3 (2) - should map to imod_1 On a different topic, I plan to purchase 2 pulse relays to open my gate and garage door. Based on the changes that you made, I would assign them as switches instead of lights using "switches" and specifying a list of switches. Since a pulse relay is not a toggle, will it appear on HA as a button of some sort or a toggle? |
|
Probably easiest if you correct the line starting with _map to fix the channels and then let me know what it should be. Debug level on the log component could help to see why it does nit update, you should be looking at: homeassistant.components.sensor.qwikswitch: debugSwitches are toggles, scripts can be fire once type push buttons. No idea how these toggles would work though and might not fit into any existing work. Maybe also look at some of the rest based or cmdlinline scripts |
|
Fixed the name, add to your config while testing: logger:
default: info
logs:
homeassistant.components.qwikswitch: debug
homeassistant.components.sensor.qwikswitch: debug |
|
kellerza, imod channels map 100% as well as the entity names are 100% too. I configured the debug logging, but didn't see any of the logging that the sensor component should log. Funny enough, when I trigger one of the channels on the imod, the event is logged by HA, but the @id of the device shown as incremented by 1 and the cmd is LEVEL and the data is 0 or 100 as a close and open a channel. Rather odd I suspect there must be another device relaying information to the USB HUB. I decided to do an update of HA using pip3 install --upgrade homeassistant (big mistake) and now the QS component doesn't want to load whatsoever as I wanted to investigate further. I just seems that everything related to HA resolves around running this on a Pi (I spun up an Ubuntu 17.10 VM and installed HA on it), which I've ordered and I hope to get delivered tomorrow. I'll investigate further once I have the Pi running. |
There was a problem hiding this comment.
redefinition of unused 'mock_aiohttp_client' from line 10
|
kellerza, I was finally able to test the sensors. I got my Pi today and got Hass.io running. What I did was remove the qwikswitch.py from custom_components so that I could test the sensors and can confirm that your fix that you made worked fine. When I open / close the channels on the imod, they reflect accordingly. Only thing is with the debug logging enabled, I still don't see your logging specifically, not a deal breaker, just thought I'd mention it. The only logging I am seeing is below. 2018-04-04 20:50:04 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.imod_1, old_state=<state sensor.imod_1=False; friendly_name=iMod 1 @ 2018-04-04T20:48:03.137385+02:00>, new_state=<state sensor.imod_1=True; friendly_name=iMod 1 @ 2018-04-04T20:50:04.255742+02:00>> I am going to leave it here. I tried to set up automatons, but not having luck there at all and I suspect it is due to the fact that the main qwikswitch.py won't load to begin with. Which release would this become available in? FYI, perhaps update the Qwikswitch logos as well? :) |
|
Try advice from here for logging https://community.home-assistant.io/t/log-level-on-custom-component/37042 Interestingly, it shows no state for imod_1 in your logs... If this is merged by next Friday it should enter “rc” branch for a week and then proper release. You should be able to run rc on hass.io |
| """QS sensors gets packets in update_packet.""" | ||
| return False | ||
|
|
||
| def update_packet(self, packet): |
There was a problem hiding this comment.
This should be decorated with @callback imported from core.py.
| if isinstance(self.unit, type): | ||
| self.unit = "{}:{}".format(self.sensor_type, self.channel) | ||
|
|
||
| def update_packet(self, packet): |
| yield mock_session | ||
|
|
||
|
|
||
| # @asyncio.coroutine |
| async def wait_till_empty(self, hass): | ||
| """Wait until empty.""" | ||
| while self: | ||
| await asyncio.sleep(1) |
There was a problem hiding this comment.
Why do we need to sleep 1 second? That's a long time in a test.
There was a problem hiding this comment.
In the end I did not use this method, see comment below on 30second delay. Something I will fix in the upstream lib in the next release. It is a long time and will delete it! 👍
Description:
Adding some qwikswitch sensors. Sensor details as discussed on MyBB and #13509
[WIP] device specific SENSORS needs to move to the pyqwikswitch libraryyaml config:
cc: @ipodmusicman