Tuya LOCAL with energy monitoring and without tuya-convert

Locally as suggested by the name. The official tuya integration uses the cloud.

Could I manage my devices not having internet but connected to the network?

as it is called the official integration of Tuya uses the cloud?? please

I’m not quite sure what you mean? I believe you don’t need Internet once you have set up an account at Tuya developer portal and all that, but I’m not sure as I haven’t tried it. Once the devices are provisioned, I.e. connected to your WiFi and available via IP, you don’t need Internet access anymore.

you need internet only for the initial pairing

hello i try a few days to this custom component to work this is my config and my log

  • platform: localtuya
    host: 192.168.*.**
    local_key: ********************
    device_id: ********************
    name: tuya_01
    friendly_name: tuya_01
    protocol_version: 3.3
    switches:
    sw01:
    name: tuya_wc_light
    friendly_name: WC light
    id: 1
    sw02:
    name: tuya_hallway_light
    friendly_name: Hallway Light
    id: 2

Error while setting up localtuya platform for switch
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 187, in _async_setup_platform
await asyncio.gather(*pending)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 293, in async_add_entities
await asyncio.gather(*tasks)
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 452, in _async_add_entity
entity.async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 290, in async_write_ha_state
self._async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 317, in _async_write_ha_state
attr.update(self.device_state_attributes or {})
File “/config/custom_components/localtuya/switch.py”, line 220, in device_state_attributes
self.dps(self._config[CONF_CURRENT_CONSUMPTION]) / 10
TypeError: unsupported operand type(s) for /: ‘NoneType’ and ‘int’

it doesnt work…any idea appreciated :smiley:

Looks like a bug to me, I can have a look at it later.

Localy.
But you have to got the local_key

there is a reason to believe that the dps is been set with wrong numbers… :upside_down_face:

check this out… i changed the numbers id: 10 and id: 38 instead id:1 id:2 and works for a while
after a Reboot is up and running flawlessly
thank you
“dps”:{“1”:false,“10”:0,“2”:false,“38”:“off”,“40”:" "

Yeah, datapoints are generally specific to each manufacturer (but some are commonly used more often). So you need to make sure they match. If we have hardcoded DPs in the code the needs to be changeable, write an issue in the repo and we’ll fix that.

Hi, i have BW-SHP6 Plug with PM, after Update to HA 0.115.2 i have a problem.

2020-09-22 14:58:15 WARNING (MainThread) [homeassistant.components.switch] Updating localtuya switch took longer than the scheduled update interval 0:00:30.

I can not control the plug. After HA reboot is everything working as it shoud.

Anyone had any luck adding Tuya RGB Bulbs via this integration? If so, what does your YAML look like?

RGB is not supported yet but being worked on:

Thanks! Should have known to check the issues before asking here.

Let me know if I can be any help in testing. I’ve got a few Treatlife RGB+CCT bulbs.

I think the best thing to do is helping out in the issue. I’m not that involved since I don’t have any RGB lights, but brutegreen seems to be doing some process so he might need testers.

I’ve been using this component for quite a few months. I recently got some RGB LEDs so I upgraded the version to try and get them working (I know there are still issues and it’s not fully implemented yet)

What happened though is all of my old switches kept constantly becoming available the unavailable every 10 seconds or so. I reverted back to the old version I was on and the problem has gone away.

Just wondering if anyone else has experienced any issues like this.

So, after some weeks of heavy coding, a new v.2.0.0 has been released, which contains a lot of improvements:

  • faster communication and status update
  • config flow support
  • improved structure
  • and more.

For everybody using this custom component: if you are upgrading to 2.0.0, please read the README carefully: you must refactor the YAML files completely because the structure has been totally revised. BUT you can alternatively configure your devices using the Integrations GUI: please refer to the README file. Also, note that we have tested carefully only switches and covers, other platforms (fans and lights) will probably have some issues but we don’t own these devices so some testers are needed: please report problems in https://github.com/rospogrigio/localtuya-homeassistant/issues . Climate will be introduced shortly (I hope).
My personal thanks goes to @postlund for the huge effort he is putting in this repo, boosting the quality level and integration with Home Assistant to top level coding, couldn’t imagine this little component could have gone so far. Also thank to @andrewmeepos for the help with covers supporting Positioning. And a lot is yet to come!
Thank you

3 Likes

Hello, it looks like this project is going very well and might be the time for me to jump in.

I just have one question before I do: When I manually press a switch and turn a light on, how long it takes for HA to receive this information and “know” the light is on?

Currently it can take minutes using the default cloud integration and it’s by biggest annoyance.

It still takes some time (a little less, recently). The next implementation (with asyncio) will change this behavior, and the status variations will be “pushed” to HA so it should be much quicker, it will be tested in the next days… just a little patience. Have a look at https://github.com/rospogrigio/localtuya-homeassistant/pull/62 .
Bye!

2 Likes

Current poll time is 30s, so at most that. When we change to have a persistent connection, it will be instant. As in really instant.

3 Likes