UPB lighting

Invalid config fixed with 0.0.6-alpha build.

1 Like

Do you want to open this as an issue and tag it as ā€œinvestigateā€?

Not at the moment. Maybe later.

Iā€™m currently having difficulty testing UPB events.

  • Iā€™m using 0.0.6-alpha
  • I added upb.scene_activated to Developer tools > Events > Listen to events
  • Clicked Start listening
  • Pressed a button that activates link 2.
  • I see no response in the UI

I changed it to upb.scene_activate but got the same result.

What is your recommended test procedure for evaluating events? Also, where in the source code does it generate events?


EDIT

FWIW, this automation wasnā€™t triggered when I pressed a button that activates link 2:

- alias: 'UPB event'
  trigger:
  - platform: event
    event_type: upb.scene_activated
  action:
  - service: persistent_notification.create
    data_template:
      message: 'entity_id: {{trigger.event.data.entity_id}}'
      title: 'UPB Scene Activated'

What am I missing here?

Here is what is working for me:

  - id: scene-activated
    alias: "Scene activated"
    trigger:
      platform: event
      event_type: upb.scene_activated
      event_data:
        entity_id: scene.family_room_half
    action:
      service: system_log.write
      data_template:
        message: "Activated '{{trigger.event.data.entity_id}}' Data '{{trigger}}'"

And the log that is generated on a button push:

2020-02-02 22:51:50 ERROR (MainThread) [homeassistant.components.system_log.external] 
Activated 'scene.family_room_half' Data 
'{'platform': 'event', 'event': <Event upb.scene_activated[L]: entity_id=scene.family_room_half>}'

Iā€™m sure I donā€™t need the event_data on the trigger, but no time to try right now.

The code is in scene.py. Look for fire.

Comment moved to GitHub: https://github.com/gwww/hass-upb/issues/1#issuecomment-581622868

1 Like

New version 0.0.7-alpha release up. Moving fast, so surely some bugs, but heading in a good direction. THANK YOU for all the testing everyone is doing!

@gwww I got everything switched over and I found that bug. Thanks for the wicked-fast turn around. Good timing for all this being the wife wasnā€™t home tonight.

Weā€™re live!

FYI
Posted new issue: Light entityā€™s state is unchanged after using upb_light_fade_start service.

In the light.turn_on service, how is the value of transition mapped to UPBā€™s fade_rate values?

UPB fade_rate values

0 = Snap
1 = 0.8 sec
2 = 1.6 sec
3 = 3.3 sec
4 = 5.0 sec
5 = 6.6 sec
6 = 10 sec
7 = 20 sec
8 = 30 sec
9 = 1 min
10 = 2 min
11 = 5 min
12 = 10 min
13 = 15 min
14 = 30 min
15 = 1 hr

@gwww

UPB supports the sixteen discrete time-periods (shown above) whereas Home Assistantā€™s transition option is expressed in seconds.

If I set a lightā€™s transition to 45 (seconds) how is that converted to one of UPBā€™s sixteen fade_rate values? Is 45 rounded up to the closest matching fade_rate level? In other words, for this example, it would be 9?

I have a pretty basic setup with 10 devices. So far itā€™s working pretty great. I have not tried scene entities yet. Iā€™ll try to do that tomorrow.

1 Like

@webmtn

How does one go about acquiring the following information from a device?

  1. If the device is programmed to report its state when operated manually.
  2. The deviceā€™s default fade-rate.

The Get Register Values command can request a Register Values Report from a device but I donā€™t know which registers store the default fade-rate and status reporting.

The documentation (from PCS) simply says this:

If I understand it correctly, the first 64 bytes of the Setup Register are collectively known as the UPBID and are consistent for all brands of UPB devices. The remaining bytes are called Configuration Registers and their contents depend on the manufacturer. So is it possible that the two properties Iā€™m requesting are not located in the same Configuration Registers for PCS, Web Mountain, and Simply Automated?

Latest build is up 0.0.11-alpha.

All open issues have been have been coded and uploaded! Yipee!!

Time to open some more :slight_smile: Add enhancements of what you would like done next.

I will be out of country, and hence not coding or responding to emails from Feb 14-24. Maybe get lots of testing done then!

Before you leave, can you explain how transition is being handled? Or direct me to where itā€™s being done in the code?

If I set transition to 45 (seconds) how is that converted to UPB fade-rate? Rate #8 is 30 seconds and rate #9 is 1 minute. Is the transition value rounded up to the nearest fade-rate?

Not leaving for another week :slight_smile:

The value entered for a transition is passed on directly to the end device. So if you enter a 6 youā€™ll get 10 seconds (the table you posted is the translation Iā€™m using in my description here). So, you canā€™t enter 45 seconds as a transition value. You could pick a value of 8 to get a 30 second transition or a value of 9 to get a 1 minute transition.

I can point you to the code but it is super boring. As I say above it just takes the number you give and shoves that out onto the wire.

The reason I pass it on directly is I donā€™t know how a device will respond to the transition value.

Better ideas most gladly accepted!

Thanks, I didnā€™t know it uses the supplied value verbatim (i.e. uses it as UPB fade-rate).

I think that may need to change in the future in order to comply with how Home Assistant defines transition. The value represents time in seconds. Thatā€™s why I had asked if it was being rounded to match the nearest discrete UPB fade-rate.

I use rate for Scenes for that reason. Youā€™re right, need to do something about transition for lights. I just donā€™t know what that is.

I could map it to the closest value, at least for the values we know. The problem is what do all the devices do? And, if we did map it for lights then should probably use the same mapping for links.

I suggest mapping it to the nearest discrete fade-rate value.

The documentation for the UPB integration can explain that transition values are mapped to UPB fade-rates and the maximum duration is 1 hour.

I donā€™t understand the question. Wonā€™t the devices simply change their brightness at the specified fade-rate?

Thereā€™s no documentation on the transition rates. If we map them we may not get the desired effect on devices that donā€™t use the same rates as the devices we know about.

Look in the UPB Command Wizard, at the step where you would specify fade-rate, it lists the fade-rate values and the durations they represent. Thatā€™s where I got the list I posted above.


EDIT
Used transition when I meant fade-rate. Duh.

Sorry, 123 Taras. Iā€™m out of town right now and not back until next Monday and just now saw this. On the first question - ā€œIf the device is programmed to report its state when operated manuallyā€ - Iā€™m assuming you want to know if the device is programmed like that - and you already know how the device responds when the switch is operated manually.

Your assumption at the end is correct. Once you get into the Configuration Registers, all bets are off between manufacturers. Itā€™s possible that there will be some commonality between manufacturers, but itā€™s not guaranteed. And, the SA / WMT devices are very different from the PCS devices. When I get back, I can try to find my register maps and see where that information is located on our dimmers and then try to determine if thatā€™s where the same information is located on the PCS or SA devices. I might be able to find this information for the PCS devices, but doubtful for the SA devices.