awesome thank you!
Wow. Thank you sooo much @ryanmsnyder for this instruction. I was waiting for a possibility to add my Smartmi P1 to Home Assistant since I bought it 1,5 years ago. Finally it is working!
Great instruction for adding it.
I just had some small problem with the mapping because I was following your guide and didnt realize that the internal ID 22 was not written in your instruction. So the following IDs were mapped wrong in my first attempt. Maybe you can include ID 22 in your instruction (I added it as sensor with name Test). This could help other users to avoid this mistake. And after the setup I also removed this ID from my setup.
Thanks for this! What device types did you use for these additional entities? Iād love to get the manual fan speed setting working, but I havenāt been able to find the right combination yet.
Can you also please confirm that when you click on the edit button it lets you add additional data points? Iām seeing that it lets me delete existing data points, but not add anything new. Running 2022.8.5 with version 4.0.1 of the LocalTuyal integration. Just wondering if something changed or if Iām just blind.
[update]
For the fan speed. Looks like you can include the 109 setting in the initial āfanā definition as shown here and it will then expose the fan speed in the home assistant controls
when I try to get local key, I get "
ācodeā: 1106,
āmsgā: āpermission denyā,
āsuccessā: false,
ātā: XXXX,
ātidā: āXXXXXā
what can I do?
@ald112 I also had this exact error when I used the API Explorer on the Tuya IoT Platform. I simply used the wrong API. The correct one is located here:
hey @vegardan thanks for responding
you tried with p1?
I donāt succeed on all the regions to get the key, same permission deny ):
you on which region you are on the tuya app on the phone?
Thanks so much for figuring out the entities. Got both my P1ās in.
I never had it in the tuya/smart life app (just three bulbs I couldnāt flash) but a quick bind from already being in HomeKit and then using the Tuya-Cli wizard on the pi which I hadnāt used in like 16months and boom works like a charm.
I thought my developer account expired many months ago but the tuya cli tool on the Pi with node.js/npm works fine still so not sure the developer account was needed but maybe it still was - I know things have changed on tuya developer side for sure but thought Iād let people know the Tuya-Cli wizard works like a charm for getting the token secret if check out GitHub repo.
Cheers!
Forgot to test everything out and fan speed controls werenāt working so I tweaked the max fan integer from 9 to 100 and also changed DP value type selector at the bottom of the pop-up window to āintā and now everything is working like a charm except for screen brightness but Iāll find the correct tuya values and report back when I do although not too concerned about that entity.
Thanks again homies!
@ryanmsnyder - what did the screen brightness input values end up being
The smartMi manual says it has a light/lux sensor on top - too bad that doesnāt seems to be ID22, that or I was hoping it was a switch to reset filter life. Works great with the HACS purifier card too!
I still dont succeed
the p1 working via smartmi app
working via HomeKit app
I see it on Tuya via HomeKit information - binder
but when I try to get device info on Tuya platform I always get permission deny.
help please
@ryanmsnyder detailed the vast majority of the setup above, and @ballakers
tweaked the fan config to get the speed working. I figured out the
remaining data points, and Iām posting an updated configuration guide
below:
How to Integrate Smartmi P1 into Home Assistant via LocalTuya (Updated)
1. Start the Guide at the Following Post
Notes:
- Complete steps 1 - 4
- Start step 5, and come back after reaching the first āEntity type
selectionā prompt
2. Continue Adding P1
Notes:
- When adding any data point, you will be prompted to select a platform
before selecting the data point (ID). This updated guide lists the
platform selection, and then all the necessary configuration options
follow. - Starting with the second data point, you must uncheck āDo not add any
more entitiesā to add each additional data point. - The friendly names for your entities are person preference. You can name
them whatever you choose.
Useful DPs:
(These data points control functions or provide important data)
-
Platform: fan
ID: 1
Friendly name: Smartmi Air Purifier P1
Fan Speed Control dps: 109
minimum fan speed integer: 1
maximum fan speed integer: 100
DP value type: int -
Platform: select
ID: 3
Friendly name: Smartmi Air Purifier P1 Mode
Valid entries: auto;sleep;strong;manual -
Platform: switch
ID: 7
Friendly name: Smartmi Air Purifier P1 Child Lock -
Platform: switch
ID: 101
Friendly name: Smartmi Air Purifier P1 Sound -
Platform: select
ID: 110
Friendly name: Smartmi Air Purifier P1 Screen Brightness
Valid entries: BRIGHTNESS_AUTO;BRIGHTNESS_OFF;BRIGHTNESS_LOW;BRIGHTNESS_HIGH
User Friendly options: auto;off;dim;bright -
Platform: select
ID: 103
Friendly name: Smartmi Air Purifier P1 Timer
Valid entries: 0_hour;1_hour;2_hour;4_hour;8_hour
User Friendly options: off;1 hour;2 hours;4 hours;8 hours -
Platform: sensor
ID: 19
Friendly name: Smartmi Air Purifier P1 Timer Remaining
Unit of Measurement: min
Device Class: duration -
Platform: sensor
ID: 2
Friendly name: Smartmi Air Purifier P1 PM2.5
Density Unit of Measurement: Āµg/mĀ³
Device Class: pm25 -
Platform: sensor
ID: 102
Friendly name: Smartmi Air Purifier P1 PM10 Density
Unit of Measurement: Āµg/mĀ³
Device Class: pm10 -
Platform: sensor
ID: 104
Friendly name: Smartmi Air Purifier P1 Filter Life Remaining
Unit of Measurement: % -
Platform: sensor
ID: 105
Friendly name: Smartmi Air Purifier P1 Filter Usage
Unit of Measurement: h
Device Class: duration -
Platform: sensor
ID: 22
Friendly name: Smartmi Air Purifier P1 Fault Alarm
*This data point isnāt documented, but the name of the data point was pulled from the Tuya IoT API. 0 means there is no fault. Other potential values are unclear.
Completionist DPs:
(These data points are completely unnecessary)
-
Platform: select
ID: 108
Friendly name: Smartmi Air Purifier P1 Device Color
Valid entries: unknown;dark_grey;sliver
User Friendly options: unknown;Silver;Dark Gray
*The values for this data point are reversed in the app. Also, the misspelled āsliverā is the actual valid entry. -
Platform: sensor
ID: 107
Friendly name: Smartmi Air Purifier P1 Country Code
*This data point could be configured as a select instead, but the device wonāt accept any changes other than the current country and unknown. -
ID: 109
*This data point is the manual fan speed setting. Donāt bother configuring this, as it is redundant. It is already linked to and controlled by the fan above.
Can LocalTuya be setup using the configration.yml file?
No.
https://github.com/rospogrigio/localtuya#adding-the-integration
NOTE: starting from v4.0.0, configuration using YAML files is no longer supported. The integration can only be configured using the config flow.
I was trying to add my fan now but this settings are not the correct one anymore, do you have any updated settings?
I know for a fact that these settings are still correct. What issue are you facing with adding yours?
Iāll try to add it again later, but the settings pop-up are different during the installation of the fan
You need to be more specific if you want help. Ideally, you should provide screenshots of the pop-up that youāre having an issue with.
Iāll do that Iāll get back
So, when Iām at step 3 I donāt see the proper options as you describe I do see this.
Sorry for the late answer I was at the hospital with my child
You donāt need to apologize. I hope your child is ok.
So first, I donāt know why you said youāre at step 3ā¦ Clearly you completed steps 1 - 4 of the original post, and are working on step 2 of my post. There is no step 3 of my post.
Iām also not seeing why you think the options are different. Your screenshot shows the ID selection described in my post.
I did notice after the screenshot that everything was like yours.
I did re-add everything then I guess it did get ānormalā
Thanks