Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incoming data parser, set_ct, set_xt #13

Open
quenthal opened this issue Mar 16, 2016 · 7 comments
Open

incoming data parser, set_ct, set_xt #13

quenthal opened this issue Mar 16, 2016 · 7 comments

Comments

@quenthal
Copy link

I can't get those two to work at all, are they implemented in handlers? set_on, off, bri work as expected.

@falk0069
Copy link
Owner

I assume you mean set_ct and set_xy, right? Are using the script_handler or the isy_rest_handler in your config? I'm really only familiar with the script_handler and I thought there was a basic handler for them defined. Are you seeing any errors reported when using them?

@falk0069
Copy link
Owner

I'm looking at the code and it looks like ct and xy are only partially defined. I could probably add in the missing pieces pretty easily. I just need to figure out all this super class stuff which is some new code recently merged in. Most folks have only been interested in brightness and power. I'm not even sure how to have my harmony issue a 'ct', but I know 'xy' is possible. I'll try to have something ready to test in the next few days.

@quenthal
Copy link
Author

Yes - I'm using script handler. I quickly checked and noticed the same. When I change xy -value, even then only bri or on is being handled. And in most cases that is enough, I agree.

(In fact, in addition to lamps not supported by Harmony I'm using real Hue Bridge as well. As Harmony has capability of only handling one Hue Bridge, I'm also handling real Hues thru hueupnp.py, script handler, and curl gets to Hue Bridge. This is infact how I noticed that I couldn't pass xy (or ct) values.)

@falk0069
Copy link
Owner

I released new code and added in 'xy' and 'ct' so they get processed. I only tested 'xy' because I don't have an easy way to send 'ct'. Basically in the set() function only 'bri' and 'on' were checked. So, I added in some extra checks for 'xy' and 'ct'. I'm not reporting success/fail for them, though, since the set() function only allows one status and I don't want to break the 'on'/'bri' if 'xy'/'ct' is also passed at the same time.

One additional note, python's exec() doesn't like square brackets included as parameters. There might have been a way to escape them, but it was just easier to remove them. So, if 'xy' equals = "[0.443, 0.195]", it is replaced as "0.443, 0.195". I hope that is fine.

Here is a clip from my log when 'on', 'bri', and 'xy' are all passed at the same time:

2016-03-16 22:27:05,820 [DEBUG] In set method. Data={u'on': True, u'xy': [0.4638, 0.3902], u'bri': 166}
2016-03-16 22:27:05,820 [DEBUG] bri received: 166
2016-03-16 22:27:05,821 [DEBUG] Running: ./hue-upnp-helper.sh PC WOL on true
./hue-upnp-helper.sh called with 'PC WOL' 'on' 'true'
Running directive for PC WOL
1 on true
2016-03-16 22:27:05,838 [DEBUG] Running: ./hue-upnp-helper.sh PC WOL bri 166
./hue-upnp-helper.sh called with 'PC WOL' 'bri' '166'
Running directive for PC WOL
1 bri 166
2016-03-16 22:27:05,849 [DEBUG] xy received: [0.4638, 0.3902]
2016-03-16 22:27:05,850 [DEBUG] Running: ./hue-upnp-helper.sh PC WOL xy 0.4638, 0.3902
./hue-upnp-helper.sh called with 'PC WOL' 'xy' '0.4638, 0.3902'
Running directive for PC WOL
1 xy 0.4638, 0.3902

@quenthal
Copy link
Author

Had to make some modifications, but now works just fine, both xy and ct.

For xy I had to make following change (I also added the [] in helper.sh)
p = subprocess.Popen([self.program, self.name, "xy", str(value).replace(' ','')])

For ct adding str(value) was enough.

@quenthal
Copy link
Author

I'm using real Hue hub behind hue-upnp as well (kinda like passthru), since Harmony can handle only one Hue Hub. ( Sadly it seems that hue-upnp isn't that compatible with different hue apps on my phone - has to set up temporarily ha bridge with same mac, ip and port to connect with app, then I could shut down ha bridge and relaunch hue-upnp. Color changing doesn't work (harmony sends only ct or xy, but maybe these apps are sending also some other parameters so these doesn't get changed))

@falk0069
Copy link
Owner

That is quite interesting. So, in your helper.sh are you then making a bunch of wget or curl calls? We can try continuing expanding the functionality if you want to capture these other directives. If you want you can send me some debug logs and I can try and pick out the other directives that are being dropped. Or if you want to continue play with it and let me know the outcome, that would be cool too. I'm willing to help if you want.

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

No branches or pull requests

2 participants