Tuya LOCAL with energy monitoring and without tuya-convert

I have a Kogan 2S air filter (https://www.kogan.com/au/buy/kogan-smarterhome-4-stage-air-purifier-2s-with-h13-filter-130-cadr/). Its basically a fan with different data.

I have the on/off switch working, and the “filter remaining %” and the “timer minutes remaIning” values reporting with localTuya v3.01 which is great (thank you all), using this code:

  - host: 192.168.1.xxx
    device_id: xxx
    local_key: xxx
    friendly_name: Air Filter
    protocol_version: "3.3"
    entities:
      - platform: switch
        friendly_name: Air Filter Switch
        id: 1

      - platform: sensor
        friendly_name: Filter Remaining
        id: 5
        unit_of_measurement: "%"

      - platform: sensor
        friendly_name: Air Filter Timer Remaining
        id: 20
        unit_of_measurement: "minutes"

These are all the DPs and their use:

'1':   false,   power off / on
'4':   '3',     fan speed, '1' = sleep, '2' = high, '3' = auto
'5':   97,      remaining filter %
'11':  false,   unidentified, could be wifi connection related ??
'19':  '1',     timer value, '1' = no timer set, '4' = 4 hour timer set, '8' = 8 hour timer set
'20':  0,       minutes remaining on timer, 0 = no timer set
'22':  '1',     air quality indicator ('1' = blue = excellent, '3' = orange/yellow = normal, ?? = red = poor)
'101': '2',     status led brightness level, '1' = low, '2' = high, 'cancle' = off (yes the spelling is incorrect)

I would also like to be able to read the air quality indicator value (#22), and also read and control the fan speed (#4), the timer value (#19) and the LED brightness (#101).

Can anyone suggest where to go from here? As a beginner I have no idea how to read or set non-numeric sensor values.

1 Like

I have to say Thank You All for this topic as it helped me to add tuya plugs Nooie to local Home Assistant and block all communication with outside.

Tutorial for other with Nooie plugs:

  • Nooie app version 2.0.8 will display device ID in app at device info, no need to hack/install anything.
  • all you need is a rooted android device or emulator and you will find all data: ID, Key… for all your registered devices in file: /data/data/com.nooie.home/shared_prefs/Nooie_Home.xml

:partying_face:
Thank you Nooie, I can now recommend your tuya plugs for this easy integration experience … I still prefer a device I can flash with Tasmota OS. :grinning:

I have a PR for better Fan support; I am using it with a REPHO air filter.

The current code assumes all sensors are numbers, and will do stack dumps on everything else.

@rospogrigio I am also having the same errors in the log. I have four BNC-60/U133TJ and 3 of them work perfectly but the last one gives the same error. I have tried pinging the IP address with the port 6668 and I know the port is open but still HA can not still connect

@OfWonder we also need the configuration you are using to help debugging. Please note that the configuration syntax for a lot of devices has changed recently so you might need to have a look at the README, and at the init.py file.
Also, would be interesting to know which devices you are using :wink:

Thanks Thomas. Am happy to wait :slight_smile:

Good new!
I’m testing pull # 120 (https://github.com/rospogrigio/localtuya/pull/120) and in addition to managing color and color temperature, now it can also manage the SonOff that was driving us crazy!
Integrated the SonOff SmartLife and it works perfectly.
Thanks again for developing and implementing this fantastic component!

1 Like

I’m probably being thick but how are you supposed to know what to pick at this stage…

For each entity, the associated DP has to be selected. All the options requiring to select a DP will provide a drop-down menu showing all the avaliable DPs found on the device (with their current status!!) for an easy identification. Each entity type has different options to be configured, here is an example for the “switch” entity:

My Gosund Mini Smart Plug offer this…

1 Like

The documentation for this rather scarce at our end, we should document that better. But DP 1 is the main state (for turning on/off) and what you should select as ID. You can tell by it being a boolean and the fact that you know it’s a power plug. DP 18-19 are power consumption (current, current consumption and voltage in that order). That’s part of the default DP set used by most tuya devices.

1 Like

Brilliant, thanks for your help, all was quite straightforward up to that point.

Thought I’d give this a try before flashing and very impressed how easy this is so won’t be flashing now :+1:

Thanks for this quick and concise post with the screenshot, just what I was looking for and easy to do from that, so thanks!

Thanks for this - great to find this solution as looks way more stable that other options I was investigating.

Am plodding through the fairly confusing instructions on Github (well you did warn us!) - Just about there, but just hit a silly question…

It mentions: ’ On the command line, run tuya-cli wizard

Where exactly should I be running this? Have tried running on HA and it gives ‘command not found’. Any tips?? Sure I’m doing something silly!

It’s easiest if you try to install that on another computer on the same network as you intend to add your devices to. If you run HassOS it’s just cumbersome to do it there.

Thanks for this - ok I’m descending to really stupid questions now - so does this need to be a linux build or can I run it from a windows PC etc? Feel free to point me to an idiots guide or something if easier! Use Putty normally for cli work, but naturally would be attaching to another server/pc/raspi

Should work on Windows as well. Just install nodejs first:

Then install with npm according to instructions:

npm i @tuyapi/cli -g

I’m not a windows nor nodejs guy myself, so I’m not that good with the details.

Is 2.03 working with HS 117 now as installed via HACS ? If not it seems I can only revert using HACS to 2.02 (not 2.01)

Until we get the PR merged for inclusion in HACS default repo list (which takes some time it seems), stay on 3.0.1.

Thanks Pierre,

Sorry I confused the Q with 2.0.3 and 2.01 - I meant 3.0.3 and 3.0.1 I had kind of assumed the just released 117 might have your pull request merged. Also curiously 3.0.1 is now available as a downgrade via HACS - I am sure that wasn’t a few days back. Hence my Q.

All OK now

I believe this was already asked here, but just making sure:

Currently I have a few devices (lights, switchs, led strips) that I would like to use with Tuya Local, but I also have other devices (RF gateway/alarm and IR controller) that I control mostly through the default integration and the scenes that are imported.

Is there any way that I can run these two integrations? Maybe create separate accounts so that some devices are linked to my tuya local account and others are linked to a cloud only?

Thanks in advance!

The PR is in the hacs/default repo, which is unrelated to Home Assistant. It’s @rospogrigio that manages releases, I just hit the keyboard with a trout (wearing a bow tie and a tiny, tiny yellow hat) continuously until PRs with new features falls out.

1 Like