Did you set correct limits for the brightness ranges here? I might have to add some debug points again to see if it works better. Also, feel free to post future logs in the PR instead so we better can keep track of what’s not working.
Hi @postlund,
in the light.py file of the repository “https://github.com/rospogrigio/localtuya-homeassistant/pull/84” there is no longer the possibility to set the levels for the MIN and MAX attributes.
is this the custom localtuya right?
localtuya-homeassistant-fix_0d_devices
I also tried to put back the repository “https://github.com/rospogrigio/localtuya-homeassistant/pull/80/” file localtuya “localtuya-homeassistant-light_range”, but here I have the problem that I can’t even manage the ON and OFF status even by setting my values 10 / 1000
PS Where do you want me to write the logs to keep track?
I have rebased #80 now, so it shall have all the fixes you need. Please try it out. You can write updates/logs in #80.
That’s perfect!
@rospogrigio I think in general we should ask people to create new issues for bugs and feature requests, rather than take the lengthy discussion here. Any thoughts?
Except for some polishing, I’m done. Would love some input. You can try it out here:
Thanks for your efforts.
Checking it out now.
Something like this will do:
git fetch origin
git checkout origin/discovery_updates
I had it originally installed from the zip file back in early July so my config yaml needs to be re-worked to suit current file structure.
Previously I had
switch:
- platform: localtuya
host: 192.168.1.20
local_key: 0117a0655exxxxxx
device_id: 655256142462abyyyyyy
name: tuya_kitch_01
friendly_name: tuya_kitch_01
protocol_version: 3.3
current: 18
current_consumption: 19
voltage: 20
so now I need:
localtuya:
- host: 192.168.1.20
local_key: 0117a0655exxxxxx
device_id: 655256142462abyyyyyy
friendly_name: Tuya Device
protocol_version: 3.3
entities:
- platform: switch
friendly_name: Kitchen Plug 1
id: 1
current: 18 # Optional
current_consumption: 19 # Optional
voltage: 20
but I am getting invalid config
Invalid config for [switch.localtuya]: required key not provided @ data['device_id']. Got None
required key not provided @ data['friendly_name']. Got None
required key not provided @ data['host']. Got None
required key not provided @ data['local_key']. Got None
required key not provided @ data['name']. Got None. (See ?, line ?).
Is the README.md up to date?
The config looks about right. Just run with id 1 for the moment, usually correct. IP address is to the plug, but try enter another IP address instead. It should hopefully recover, that’s the point.
That error comes from your old switch
config, just remove it.
Edit: README.me in the repo should be ok.
It was getting fussy with me. I needed quotes around the 3.3 in the version line.
Now it is connecting ok and all voltage, current etc. values are reading as well.
Looking good! Great work.
I shall explore the other 2 devices and see if they pick up on change of ip address.
Oh I see that sensor entities are not created for the voltage, current values with the above config so I need to add these as extra entities with their own id number?
They show as values in the switch entity but need to be created separately so as to show in lovelace cards.
Yeah, you need to add additional sensor
entities to pull those values out. I think there’s an example in the readme (at least for one type of sensor).
value_template: {{ state_attr(‘switch.yourtuya’, ‘voltage’) }}
You can do it natively without having to clutter with additional template sensors directly in the integration.
One question is
device_class: current_consumption
no longer valid?
I had this
- platform: sensor
friendly_name: Plug 1 Power
id: 19
device_class: current_consumption
but get
Invalid config for [localtuya]: value is not allowed for dictionary value @ data['localtuya'][0]['entities'][2]['device_class']. Got 'current_consumption'
value is not allowed for dictionary value @ data['localtuya'][0]['entities'][2]['platform']. Got 'sensor'. (See /config/configuration.yaml, line 273).
Yeah I was thinking the same. I’d leave this huge thread for questions, proposals or first-level support but would move issues-solving in new Issues posts and/or related PRss. So I’d ask @SmartM-ui and @juan11perez to continue with the discussion with their issues in the PRs created for them.
Agree?
Use Device_class: power
(unit kWh) / Device_class: energy
(unit W) / Device_class: current
(unit A) and Device_class: voltage
(unit V) and Device_class: power_factor
(unit Pf)
Hi all, I finally published a new release, v.3.0.0 that introduces:
- asyncio in communication, with push updates: now status changes are immediate (also from physical buttons!)
- persistent connection, instead of open-close connection; NOTE: some devices don’t support multiple connections, so it will not be possible to use Tuya app together with HA for those devices
- (minor) brightness range remapping for light platform
Enjoy, and super thanks to @postlund for the amazing job !
THANK YOU!
Great job, you are SUPER