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

How to create a fan json file, and the fan entity? #75

Open
hplato opened this issue Jul 14, 2024 · 6 comments
Open

How to create a fan json file, and the fan entity? #75

hplato opened this issue Jul 14, 2024 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@hplato
Copy link

hplato commented Jul 14, 2024

I have a kendal RF fan, and have successfully captured the RF codes through my broadlink rm4 pro. It has 6 discreet codes for speed, and toggles for power, direction and light. Can I use SmartIR to create a proper fan entity? looking at some of the code json files, I'm not sure how the direction works and if the light might be able to be included. Any help would be very much appreciated, and I'll add in the json to the repository after it works!

{
"version": 1,
"minor_version": 1,
"key": "broadlink_remote_e85234282334f_codes",
"data": {
"CeilingFan": {
"1":"code",
"2": "code",
"3": "code",
"4": "code",
"5": "code",
"6": "code",
"Power": "code",
"Direction":"code",
"Light":"code"
}
}

@hplato hplato added the enhancement New feature or request label Jul 14, 2024
@litinoveweedle
Copy link
Owner

Hello,
this integration only supports native HA features/properties of the HomeAssistant. In this case fan

and in the current state only the speed, direction and oscillation. I would like to introduce support for presets as well, but it is not there yet. This means, that your on/speed, direction and off would be supported. For examples please look into existing fan device code files. I would welcome your contribution into documentation if you can provide md page describing the format.

@litinoveweedle litinoveweedle added documentation Improvements or additions to documentation and removed enhancement New feature or request labels Jul 15, 2024
@hplato
Copy link
Author

hplato commented Jul 15, 2024

Thank you. OK I'll do that. And to confirm steps;

  1. Install your smartIR through HACS
  2. Create a new json file that contains the RF commands for my fan..
  3. Create a new yaml file that contains the object, something like:

fan:

  • platform: smartir
    name: Ceiling Fan
    unique_id: ceiling_fan
    device_code: 1100 [The name of the new json file that is unique]
    controller_data: remote.rm4_pro [The name of my RM4 Pro in HA]
    power_sensor: binary_sensor.fan_power [I don't have a power sensor, can I just leave this item out?]

When testing things out, if I need to change the 1100.json file, can I just edit it and then keep trying the HA object, or do I need to reload HA?

@hplato
Copy link
Author

hplato commented Jul 19, 2024

I got basic control of the fan, which is awesome. I think I had a json formatting issue so the entity just didn't get created. So now I can adjust the speed and turn my fan off.

One thing that isn't clear to me. I have a reverse button on my remote, and I'd like to be able to add that into the fan entity. one of the json files (1000) has a reverse section, but I don't have a set of reverse speeds, just a reverse button. Any idea what key I'd use so that the reverse button shows up?

Lastly, what is involved in adding in a light entity type? My fan also has a light, and would be great to have an entity to control that element as well.

Really happy it's working!

@litinoveweedle
Copy link
Owner

Hello, unfortunately currently this project doesn't have support for discrete codes. This both include reverse and light function. I can't support each and every device - it will make project unmaintainable very fast. What I can only do is to create/register new HA service, lets call discrete_code, which would just take code from json file and send it using chosen remote. This is not too much as it currently can be also done using remote.send_command service but you will get benefit of having all the codes at one place. Than you will need to use standard HA automation to get what you need.

I also add initial commit to the new document, please let me know if you would like to contribute to it, as you have fresh experience.

@hplato
Copy link
Author

hplato commented Jul 21, 2024

That makes perfect sense. I tried using 1000.json, which had a set of reverse codes, and the reverse button showed up in HA. I was hoping there might be a way to tap into that UI.

I set in a PR with my RF codes for the Kendal Fan. That documentation page is great! When I created the fan json, I wasn't sure about the 'default' section and if it was needed. This might also be a good place to put a warning that bad json or unknown values will cause the object not to be created.

In my case, my object wasn't being created as I had bad json. I had two errors, a missing comma so the parsing failed, and I had a 'reverse' entry hoping that the button would show up. Once I fixed these two items, the object showed up in HA. The only suggestion I might make is to have a error statement if the json is bad and the object wasn't created. I didn't know if the integration was wrong, or if I did something wrong. That would have helped.

I'm not familiar with HA module coding, but curious if it would be straightforward to use the same framework for a light entity? Another set of json with on and off codes.

@litinoveweedle
Copy link
Owner

I have one question. If you press reverse button will it always sent same command, or will it cycle between two different commands (reverse on, reverse off)?

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

No branches or pull requests

2 participants