ivarho / hubitatappndevice

19 stars 4 forks source link

Only one way communication #3

Closed moshik008 closed 1 year ago

moshik008 commented 1 year ago

I can switch on/off my device, but when i am switching it manually or from another app it's not updating in hubitat. any ideas?

moshik008 commented 1 year ago

I am getting this error in the log: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: user_driver_iholand_tuya_Generic_Device_625.refresh() is applicable for argument types: () values: [] Possible solutions: every(), parse(java.lang.String), every(groovy.lang.Closure), grep() (method refresh)

ivarho commented 1 year ago

hi, the Tuya devices does not report their status in this "local configuration", you need to poll for status changes. And I think you are on the right track, however I suspect by the error message is that you are missing some functions related to the "Refresh" capability (which I haven't included in my examples). You probably just need to implement the refresh() function, and have that call the status() function (see more on capabilities here: https://docs2.hubitat.com/en/developer/driver/capability-list). If you see this post https://community.hubitat.com/t/ivarho-tuya-hubitat-driver-fixes/113334 there is a driver implementing the built-in refresh function.

My approach to this issue can be seen in the https://github.com/ivarho/hubitatappndevice/blob/master/Device/tuyaDevices/tuyaThreeGangSwitch.groovy example. Here you have the option to setup a poll interval which basically does no more than schedule running of the status() function. I hope this helps you on the way.

BR I