OMG - Tuya local HACS integration for Tuya devices in Home Assistant

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
couple of months ago I recorded video on the tuya compatible grid type micro solar inverter I went for that one because I wanted to have as much data and also possibility to control micro inverter from within home assistance and boy was I wrong but there is a new hope with the new tuya local integration for home assistant we'll be looking at how you can get local support for your two devices in home assistant with this new hacs component we'll start in couple of seconds [Music] local two-year integration from rosberg Grigio is well known and a lot of you are using it currently it has more than 1600 hearts in the git Repository but I really wasn't happy with it first of all my smart inverter didn't work with it I could pick up couple of values from it but unfortunately I wasn't able to add other functionalities or other sensors that this device has sure there is a way for you to try and get the device supported in this local 2D integration it requires you to pull some data create an issue on the GitHub repository and eventually that integration May or in this case may not be added in four months since this issue has been opened and it does include more or less everything from what I've seen that this device needs to be added to this integration there was actually no comment no post No Tag anything from the developer and I did feel a bit frustrated because I couldn't do it myself and no unfortunately nothing has been done in that time but couple of weeks ago I did see that there is a new hscs integration called tuya local don't confuse it with local tuya this is a I would say brand new integration that unfortunately also doesn't have that many devices supported out of the box there is the devices.md file where you can browse through the list of supported both types and the devices themselves but yeah it still needs a lot of work the difference between the local tuya and tuya local is as a matter of fact in how fast the things are getting worked on no I'm not telling anything bad against local tour the problem with all the Integrations that depend on one or two people is yeah time when they start they invest a lot of effort and time sometimes even money into this project But as time goes on and on interests shift so they may provide less support have less free time or something has changed they got a kid they got married or divorced or whatever and yeah and that is not enough free time but that's why currently to your local is a great way to add your Twitter devices locally in home assistant when we say local control or local tour let's make a big distinction this doesn't mean that your device will not talk with the two-year iot platform it just means that you can control and receive data from the device locally instead of going via the cloud yes sure you can potentially block the traffic going to the cloud and I do believe that it should or could or would still work but I haven't tested that part myself that means that you can opt out for tuya local if you want to try a local control of your devices we'll touch this part a little bit later down the road because I was afraid that I will not receive support even here for my smart micro inverter so I started working on the integration myself it's really easy and really straightforward to create the custom file for your device even if your device is not officially supported by this integration I will not go through the whole process but we will look at one example a little bit later on and you will see that it really is not that hard to create a custom converter for your specific device before you install the component you should get the device ID and the local key host is not required anymore it may ask you at one point if Auto Discovery fails but between the previous release and this release that was released just one or two days ago there was a significant change and it can now detect devices and find them on the network so you do not have to specify most of the time the IP address but we still need the device ID and the local key in order for us to get them click on the link here as it says the easiest way to do it is to go to the Toya developer portal my device has been added via the Smart Life app and I already do have the iot account or the to a developer portal account from the time when I was adding switchboard camera to my home assist integration and of course did bit on that if you have the iot account log in if you do not have created I will not be covering steps to create it but no you shouldn't need to pay anything for this free edition or free time of the developer account agree to terms of use click on login drag and match the puzzle and you should be inside your account for this video I will also presume that you already have inside the cloud home assistant integration available and that you already did add couple of devices we are currently interested in this device here one of the things that we need is this device ID so copied and save it somewhere on a safe place next move your mouse over Cloud select API Explorer smart home devices device management go to get device details and inside the device ID paste the device ID itself click on submit and here you will see a local key copied and this is the local key for this device because we will need both this device ID and the local ID this repository is still not part of the official hacs list at the time when you see this video it may already be but if you don't see it in the list of Integrations by going and searching for tuya local you have to do following click on three dots custom repositories copy the GitHub link and the link will be also in the video description select category this is integration and click add you will now see to your local make Dash all slash toya-local integration visible in the list click on explore and download select to your local local support for to your devices in Hope assistance so this one not local to you click on download a latest version at the time of recording is 2023.2.0 download and after it has been successfully installed we will have to restart home assistant after you got your device ID and the local key it's time to add the first device click on ADD integration type 2ya local tuya and now you have to supply either two or three variables depending on your case this Auto for the IP address may or may not work so let's start first without it depending on the type of device you are using you may or may not need to toggle or tick this box I will not be taking it click on submit if tuya local was able to Auto discover the IP address it will present you with the device type for me this is solar inverter let me click submit if we go to the to your local integration click on one device that I have here we can see that it is pulling much more information than the local tuya which unfortunately doesn't have support for this device this is the total energy produced in kilowatt hours I have a switch to turn the inverter on and off and I also have AC and DC both current and voltage plus the power that is currently being produced but what if your device is not supported how do you know the data points because you will need data points to create your own custom Quirk or Constable converter for the device that is not supported let's check this out go to Cloud for the device that you want to add support for example once again this smart inverter click on debug device device logs select the device from the list and now you have option in the drop down menu to select DPS or data points for this device press F12 in Chrome browser to open developer menu after you have switched to the network in the upper right corner select basic information this is the ID you want to select in our case cumulative output and click on search you will see a list here if you click on the list and go to payload you will be presented with the information like that we are looking for this here code this is our device ID and this code is what the PD ID actually is you need to go through the list for example this one here and find all the IDS that your device can provide for for me this is a list of I think seven or eight IDs because we also here see the information for example this DC voltage which is ID 103 is actually DC voltage this is the example of how the data should look like and when you've copied everything you can create a new issue on the GitHub repository name it for example support for smart inverter sg600md which was the ticket I opened I listed all the information I could I got all the PD IDs I created the description given here the example and the unit of measurement and that's more or less not everything that can be provided but it's a good start the other option is to pull the Toya iot information which looks something like this and this will list all the possible options for that device for example code switch 1 dp1 is Boolean countdown switch Etc but there is also one additional way on how you can try and add the device even without using the iot platform where actually you do have to use it because you need to pull the IDS from the iot platform but you do not have to wait for this integration to add support you can actually add your own support and this is something that I did and it almost matched 100 of what the author did at the end add to this integration if we go to custom components to your local devices you will see that every single device currently supported by this integration has its own yaml file if we look at this solar inverter EML file this is how the file looks like we have a name this is the product ID and by the way product ID can also be pulled from the iot platform developer platform then we have primary entity primary entity is the entity sensor name energy and the class is energy because we have here total power or total energy produced by this micro inverter the author of the component instead of putting the total increasing added here measurement so I made the pr or pull request and fixed it in this pull request it is now totally increasing this is also needed for the Energy tab in home assistant to work properly then we have secondary entities for example this one is power sensor measuring Watts here we have DC current once again measurement DC voltage ID P ID or data point ID 103 104 is ac voltage 105 is AC current and 101 is the switch on the inverter so even if your device to your Wi-Fi device is still not officially supported with the to your local integration you have couple of ways on how you can edit to your system and also help the community by then uploading that EML file into the issue and contributing to the development of this integration what I achieved previously with the local tuya I had information about the solar AC current solar ac voltage and the cumulative update and now with tuya local integration with added support for my device I can see solar inverter AC current solar inverter ac voltage DC current DC voltage energy and power inverter and that's not all I can also turn it on and off there is still one more thing that you need to do manually unfortunately at the time of recording especially for this device I'm not sure about the other devices that record the total energy used you need to add customization in my customize.yaml file which I used for the manual customizations I have added the sensor.smart underscore inverter underscore energy which is the name of the sensor for this device and I've also added last reset and here is the date that I added for the last reset by using this I'm able to add the device to my Energy tab if not you would receive there an error such as this one here if on my recording setup I go to settings dashboards click on Energy tab add solar production I can select this smart inverter from the list since I also use forecast solar I can use forecast production and I received a notification that this entity with the class measurement doesn't have last reset State go to visual studio code at the end of the file add following this has been copied from the error message sensor.mark underscore inverter underscore energy column and then just add last underscore reset column with the date go to developer tools of course check configuration and then reload location and customizations and when you add this last reset everything will be okay and after some time has passed you will see the data inside the Energy tab now you have alternative way of adding a local to your support inside home assistant with this new integration called to a local remember if you do not see it inside the HSS you need to manually edit in the repositories list I really do hope that you will find this video useful and also this integration because it really does allow you to add support even for those devices that are currently not supported yes you still need to add them to Smart Life app for example but then you should be able through iot to your developer platform to pull the information for the device which is the device ID and the local key and also create or pull the data points and add support for that device if you want into to the home assistant or into this to your local HCS integration and before I go and spend up all the money that I've saved with this solar panel let me thank all those wonderful people that are supporting me on the YouTube and that have become YouTube channel members thank you all for all of your support but also thanks to each and every one of you who has watched liked or subscribed to this channel if you do want to support the channel you can do so by clicking the join button down below or going to the merchandise store and buying something there if you have any kind of a comment or question don't forget that you can leave comment down in the comment section below and leaving comments in the comment section below plus also watching and liking the videos really helps with the YouTube algorithms so thank you but you can also go to the Discord server and leave your comment there if you did like this video please give me a thumbs up and I will be seeing you next time until then bye bye and have fun
Info
Channel: BeardedTinker
Views: 33,253
Rating: undefined out of 5
Keywords: home assistant tuya local, home assistant tuya setup, home assistant tuya 2023, tuya local home assistant, tuya local key, tuya local key extract, tuya local key homeassistant, tuya local setup, tuya local control home assistant, tuya local vs local tuya, install local tuya, local tuya home assistant, tuya local, tuya home assistant, tuya integration, tuya home assistant integration, local tuya local key, local tuya integration home assistant, home assistant local tuya
Id: apWfjargTpA
Channel Id: undefined
Length: 17min 33sec (1053 seconds)
Published: Wed Feb 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.