how did you get the localkey? I seem stuck since I have an account on the smart app that seem to be different than the iot one
I just purchased the same combo, I can get the M1 in the Tuya app by adding it as “other” wifi, and if I click on it I can see a lot of battery and temperature sensors but I fail to get the Temp sensor by itself out as an individual item in the Tuya app. The M1 then also doesn’t show in Home assistant along with all my other Tuya devices. Am I missing something?
I have the inkbird wifi gateway with 4 sensors and would love to get this in HA but when I disconnect from InkBird app and connect m1 to tuya the tuya app is all in Chinese! Is that normal? That’s as far as I got so far
I have tried the tuya app, smart life app both can see the M1 but just cannot get M1 into home assistant using the integration tuya. weird! should be simple thing i would think
If you look at
https://www.home-assistant.io/integrations/tuya
it says
Important: Not all Tuya devices are supported by the
tuya API
used by this integration. For more details refer to TuyaHA Library.There is currently support for the following device types within Home Assistant:
- Climate - The platform supports the air conditioner and heater.
- Cover - The platform supports curtains.
- Fan - The platform supports most kinds of Tuya fans.
- Light - The platform supports most kinds of Tuya light.
- Scene - The device state in frontend panel will not change immediately after you activate a scene.
- Switch - The platform supports switch and socket.
I dont think the pool temperature sensor is covered by climate category
I followed the instructions in the youtube URL below and was able to get my IBS-M1 Pool Thermometer showing up in Home Assistant.
I have included the timestamp in the URL of the particularly helpful bit that got me over the line.
https://youtu.be/nIbCkYyZn6o?t=374
Of particular frustration was the localTuya documentation getting me to run command line apps that didnt seem to work. Turns out i didnt need to run the command line apps as I was able to obtain my local key by doing the following.
For this to work, you should first follow these steps in this order https://github.com/codetheweb/tuyapi/blob/c0a1526379461d6cc0378d06c6f6a32c90c47208/docs/SETUP.md
- Create a new account on iot.tuya.com and make sure you are logged in. Select United States as your country when signing up. This seems to skip a required verify step.
- Go to Cloud → Projects in the left nav drawer. If you haven’t already, you will need to “purchase” the Trial Plan beore you can proceed with this step. You will not have to add any form of payment, and the purchase is of no charge. Once in the Projects tab, click “Create”. Make sure you select “Smart Home” for the “Industry” field and PaaS for the development method. Select your country of use in the for the location access option, and feel free to skip the services option in the next window. After you’ve created a new project, click into it. The access ID and access key are equivalent to the API key and API secret values need in step 6.
- Go to Cloud → Project and click the project you created earlier. Then click “Link Device”. Click the “Link Devices by App Account” tab.
- Click “Add App Account” and scan the QR code from your smart phone/tablet app by going to the ‘Me’ tab in the app, and tapping a QR code / Scan button in the upper right. Your account will now be linked.
Here is how I found the Device ID
Then I did this step which is different from the LocalTuya instructions
https://iot.tuya.com/cloud/ Cloud / API Explorer / Choose the correct data centre from the dropdown (mine was Europe) / Get Device Details / enter you device’s Virtual ID / Press Submit Request / find the line "local_key": "XXXX",
If you cant see anything, make sure you have ‘Smart Home Devices Management’ in the API tab of your project.
I will give this another go! thanks for the confirmation.
@del13r
I belive i got it in Home Assistant!! But not sure what to do after that…Did you configure it as a battery? hot? Cold?
I will keep trying but somehow im setting up as wrong “sensor”
OK! i got it in! but can you explain how do you get it in fahrenheit? THANK YOU so much for the help BTW!
Ok, here we go from the top.
The scaling factor was only needed for the 104 temp sensor as the value is 1452 which is 4 digits, the scaling factor moves the decimal place over 2 digits to make it 14.52 °C
I think you might just be missing the ° symbol in your unit of measurement for the temperature sensor
So, even if you want the value to be shown in °F, If the 104 temp sensor value is similar to a low number like 1500 or 2000 or 2500, I would still use °C as the Unit of measurement for the temp sensor and let Home Assistant Automatically convert it to °F.
If the value of the 104 temp sensor value is similar to a high number like 5900 or 6800 or 7700, only then would I use °F as the unit of measurement for the temp sensor.
How a value with ° will display will depend on what your system is set to under Configuration / General / Unit System.
Home Assistant will automatically convert values from °C to °F and vice versa.
I know this because
I added this to my
/config/configuration.yaml
template:
- sensor:
- name: Pool Temp in F
unit_of_measurement: °F
state: >
{{ ((( states('sensor.pool_temperature') | float ) *9/5) +32) }}
And my system still showed the value in °C
You are just better off letting home assistant do the conversion rather than creating a template
My HA unit of measure is set to imperial already but I set location and unit of measure in YAML so those options in UI are not selectable but my thermostats as example are in “f” so it is working for those. What’s weird is in the tuya app it’s in Celsius too and in the tuya app I also cannot change the setting. Very strange. Thanks again for helping I’m sure your explaining will help others too!
Can I ask what the value of 104 is showing up as for you?
Is it above 3200 or below 3200?
If it is below 3200 (which is what water freezes at in °F), you absolutely need to set the unit of measurement to °C and the Scaling Factor 0.01
Dont stress about using °C for now as HA will convert it.
For that automatic conversion to happen, its very important that you dont forget to use ° symbol.
It doesnt matter what the Tuya app shows or whether you can change it in the app as its in °C for me in the app and I can’t change it either. What does matter is what the value of the 104 temperature sensor is and what you tell Home Assistant to do with it by setting the unit of measurement for just the sensor, not your whole system. Once you get the data into Home Assistant properly formatted, you’ll never need to open the Tuya app ever again.
AH HA! i put unit of measure as °C and NOW it shows °F! ha ha! ok so thats great! now i need to figure out how to add the other sensors to tuya as it seems i cannot go back and add more the option is gone. only way i can add more is delete local tuya and on first install i can select all sensors one by one but that option is gone after first setup. Also the temp is about 4-5 degrees low compared to actual temp inkbird shows…How would you add some sort of correction or offset to the temp? Pool is actually like 86°F
I see local tuya currently don’t support adding new entities to existing devices so at least i know i need to add all at first install. so just need to figure out the offset correction on temp and finally got this working! thanks to @del13r
edit: looks like i need to add a “float” to the sensor. will look into this tonight after work
If you are absolutely convinced that the sensor should be 86°F / 30°C (which is very warm by the way), you can do a low tech test of putting the thermometer in a glass of cold water and see if the value changes to make sure you are polling the right sensor ID.
If the value changes to a lower value, and you are still convinced the thermometer is inacccurate, i would start fresh with tuyalocal and look for a value that is closer to 3000 in the ID list. Your IBS-M1 might behave differently to mine.
If you dont see any values closer to 3000, then i would do the conversion on the sensor this way.
I know that 86°F = 30°C
30°C - 27.55°C = 2.45°C difference
add the following lines to
/config/configuration.yaml
template:
- sensor:
- name: Pool Temp adjusted
unit_of_measurement: °C
state: >
{{ (( states('sensor.pool_temperature') | float ) +2.45) }}
You truly are amazing help. Yes pool is warm! I’m in Minnesota and need it warm I will try these tonight and report back. I do have analog gauge in pool and with InkBird app I had about 2.4 correction to match analog thermometer which the analog actually matches the digital reading on heater so for whatever reason the InkBird is off a bit for sure
@del13r Tried the adjusted temp code and the value i get is very strange. Any ideas?
Attaching a photo:
edit:
So i spent most of the evening going through over 20 devices that i could see from the M1 gateway and got all working but the “adjusted” pool temp. Very neat to have these Inkbird devices in home assistant! thanks @del13r for all the help i never would have got this without your help! Hope it helps others willing to take on the challenge.
Hmm, the adjusted temp looks fine on mine when I test using the following method.
You can test by going to developer tools / template
Current Value = 14.35 (uncorrected value, as shown on the right in the picture)
Then i add the +2.45 and get 16.8 (templated corrected value, as shown on the right in the picture)
Can you please show what you entered in the template section?