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

Add fanlinc support #4

Closed
TD22057 opened this issue Dec 7, 2017 · 10 comments
Closed

Add fanlinc support #4

TD22057 opened this issue Dec 7, 2017 · 10 comments

Comments

@TD22057
Copy link
Owner

TD22057 commented Dec 7, 2017

Add support for the fanlinc device. From the developers guide, the fanlinc has a standard dimmer on group 1 which can use the existing dimmer code. The fan controller is on group 2 and has the following different actions:

ON: cmd1:0x11, cmd2:0x00=off, 0x01-0x7f=low, 0x80-0xfe=med, 0xff=high
OFF: cmd1:0x13

Status command:
cmd1:0x19, cmd2:0x00 -> standard dimmer status with cmd1=db delta, cmd2=dimmer level
cmd1:0x19, cmd2:0x03 -> fan status level with cmd1=db delta, cmd2=fan level (same as on cmd)

@masterdka
Copy link

Thanks for looking into the request. I'm new to the insteon side of things but let me know what I can do to help unfortunately I lack any in-depth programming skills.

TD22057 added a commit that referenced this issue Dec 9, 2017
@TD22057
Copy link
Owner Author

TD22057 commented Dec 9, 2017

OK - I think this is ready for try number 1. I can't test very much of this yet - I don't have a good test harness to fake messages so I'm just going from docs right now. I expect we'll need to iterate a few times. To get the version for testing, you'll need to get the repository and then switch to the fanlinc branch:

git clone https://github.com/TD22057/insteon-mqtt
cd insteon-mqtt
git checkout fanlinc

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

Then edit the config.yaml with your fanlink device address and run the start command:

export PYTHONPATH=.
./script/insteon-mqtt start --log-screen --log log.txt config.yaml

In another window, watch the MQTT messages:

mosquitto_sub -v -t 'insteon/#'

In another window, try sending commands (change the dev address). Run one and watch what happens.

mosquitto_pub -t 'insteon/AA.BB.CC/fan/set' -m 'ON'
mosquitto_pub -t 'insteon/AA.BB.CC/fan/set' -m 'OFF'
mosquitto_pub -t 'insteon/AA.BB.CC/fan/speed/set' -m 'low'
mosquitto_pub -t 'insteon/AA.BB.CC/fan/speed/set' -m 'high'

Then make sure the light is also working:

mosquitto_pub -t 'insteon/AA.BB.CC/set' -m 'ON'
mosquitto_pub -t 'insteon/AA.BB.CC/set' -m 'OFF'

When it fails (and I'm assuming it's going to for now), attach the log.txt file back here. When I submit fixes, you'll need to get the updates. I'm not sure the exact command for this, but it should be something like:

git pull

@TD22057
Copy link
Owner Author

TD22057 commented Dec 9, 2017

PS: that assumes you've already paired the fanlinc with the modem (groups 1 and 2). If not, you'll need to do that first. You can try with insteon-mqtt pair config.yaml AA.BB.CC which might work. Or hit the set button on the fanlinc then call insteon-mqtt link config.yaml to push the set button on the modem.

TD22057 added a commit that referenced this issue Dec 9, 2017
@masterdka
Copy link

Thanks for the details I will try to get this round of testing done tonight once I'm relieved daddy duties.

@masterdka
Copy link

The initial testing went well was able to control the light on/off and could also set the fan on/off. As for the Fan speeds setting high worked as expected but when setting low I could see from the debug lines the command issued was set MED. So then I tried to enter the MED speed setting but command was unknown. I have attached the written log file from the testing as well but I would say over all is very good for the initial test run!

log.txt

@TD22057
Copy link
Owner Author

TD22057 commented Dec 10, 2017

Thanks! That's better than I expected. I think I found the bug - the low speed value was wrong so setting low was actually sending a medium speed message. The medium issue is that the input command needs to be 'medium', not 'med'. I think you can just do a git pull to grab the update (but I'm a git novice so I'm not 100% sure on that).

@masterdka
Copy link

Looks good I was able to do the git pull to get the updated code. Testing was perfect the high, medium and low settings work as expected now. I also tested the light on/off and still working as expected on each of the fan settings. Now I will see how the integration to Home Assistant works following their MQTT instances for each.

One other question is on the light side looks like it supports the dimming as well just curious on the command to set that value from 0 to 255?

@TD22057
Copy link
Owner Author

TD22057 commented Dec 11, 2017

Awesome. I'll merge this into the main dev branch then. Look in the config.yaml at the mqtt.dimmer section. The MQTT command needs to end up AFTER going through the template like this: { "cmd" : "on", level" : 0-255 }. However the default config.yaml payload template is configured for home assistant MQTT JSON dimmer support which means the command you need to send is: { "state" : "ON", "brightness" : 0-255 }

@TD22057
Copy link
Owner Author

TD22057 commented Dec 12, 2017

I'm going to close this since it's working. It will be pushed the main branch as soon as I finish keypadlinc support this week.

@TD22057 TD22057 closed this as completed Dec 12, 2017
@masterdka
Copy link

Thank you again for getting this working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants