Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Thermostat mode not changeable on the app #695

Open
user8446 opened this issue Jun 26, 2023 · 35 comments
Open

[BUG] Thermostat mode not changeable on the app #695

user8446 opened this issue Jun 26, 2023 · 35 comments

Comments

@user8446
Copy link

Hi just reporting that my Z-Wave thermostat modes are changeable on the Domoticz web UI but on the Domoticz mobile app. The mobile app reports the correct mode that it is in but does not have an option to change it. Any direction to debug, test, or solve?

Thermostat mode changeable on the web UI:

Screenshot 2023-06-23 164607

Thermostat mode not changeable on the mobile app:

Screenshot_20230623-165302

Smartphone (please complete the following information):

  • Device: Moto G7
  • OS: Android 10
  • Domoticz system version: 2023.1
  • Domoticz app version: 0.2.358 (9328) (Premium paid version)
@galadril
Copy link
Contributor

Thanks for registering the issue, can you maybe get some more information about that device type?

If you log in to the domoticz site, then go to this url (change first part):
http://%host:port%/json.htm?type=devices&filter=utility&used=true&order=[Order]&plan=0

Plz then find the part of that thermostat, it should look like this:

{
			"AddjMulti" : 1.0,
			"AddjMulti2" : 1.0,
			"AddjValue" : 0.0,
			"AddjValue2" : 0.0,
			"BatteryLevel" : 255,
			"CustomImage" : 0,
			"Data" : "18.5",
			"Description" : "",
			"Favorite" : 1,
			"HardwareDisabled" : false,
			"HardwareID" : 19,
			"HardwareName" : "Honeywell Thermostat",
			"HardwareType" : "Honeywell Thermostat",
			"HardwareTypeVal" : 114,
			"HaveTimeout" : false,
			"ID" : "0000004",
			"LastUpdate" : "2023-06-26 10:03:42",
			"Name" : "Thermostaat",
			"Notifications" : "false",
			"PlanID" : "2",
			"PlanIDs" : 
			[
				2
			],
			"Protected" : false,
			"SetPoint" : "18.5",
			"ShowNotifications" : true,
			"SignalLevel" : "-",
			"SubType" : "SetPoint",
			"Timers" : "false",
			"Type" : "Thermostat",
			"TypeImg" : "override_mini",
			"Unit" : 0,
			"Used" : 1,
			"XOffset" : "0",
			"YOffset" : "0",
			"idx" : "999"
		}



@user8446
Copy link
Author

Ok here is that info:

			"AddjMulti" : 1.0,
			"AddjMulti2" : 1.0,
			"AddjValue" : 0.0,
			"AddjValue2" : 0.0,
			"BatteryLevel" : 100,
			"CustomImage" : 0,
			"Data" : "Cool",
			"Description" : "",
			"Favorite" : 0,
			"HardwareDisabled" : false,
			"HardwareID" : 2,
			"HardwareName" : "Aeotec Z-Wave stick",
			"HardwareType" : "OpenZWave USB",
			"HardwareTypeVal" : 21,
			"HaveTimeout" : true,
			"ID" : "00002C01",
			"LastUpdate" : "2023-06-22 14:16:03",
			"Mode" : 2,
			"Modes" : "0;Off;1;Heat;2;Cool;3;Auto;",
			"Name" : "1st floor Mode",
			"Notifications" : "false",
			"PlanID" : "0",
			"PlanIDs" : 
			[
				0
			],
			"Protected" : false,
			"ShowNotifications" : true,
			"SignalLevel" : "-",
			"SubType" : "Thermostat Mode",
			"Timers" : "false",
			"Type" : "General",
			"TypeImg" : "mode",
			"Unit" : 1,
			"Used" : 1,
			"XOffset" : "0",
			"YOffset" : "0",
			"idx" : "119"

@galadril
Copy link
Contributor

Mm thanks that's handy information thanks.

I am wondering what kind of api call is being done when you change the mode in the web ui.

@user8446
Copy link
Author

Ok I checked and for example to turn that thermostat to "cool" it would be:

https://127.0.0.1/json.htm?type=setused&idx=119&name=1st%20floor%20Mode&description=&tmode=2&protected=false&used=true

@galadril
Copy link
Contributor

ok thats funny as it uses the name instead of the 0/1/2/3 id.
Thanks i can work with that

@user8446
Copy link
Author

Great thanks a bunch.... let me know how I can help or test for you

@galadril
Copy link
Contributor

galadril commented Jun 27, 2023

mm i expected type to be Thermostat to be fair.. thats kinda weird.
You could verify that with on the Domoticz forum (aldo ill check 'general' for now)

and my other question would be, are these modes always 0 based auto numbering?
"Modes" : "0;Off;1;Heat;2;Cool;3;Auto;"

why wouldnt it then be
"Modes" : "Off;Heat;Cool;Auto;"'

I dont really get why they didn't implement the same level logic as they have for for example selectors

@galadril
Copy link
Contributor

galadril commented Jun 27, 2023

Do you know if these command also work to set the mode?

login to web domoticz, then try these commands to see if they work:

https://127.0.0.1/json.htm?type=setused&idx=119&tmode=2
https://127.0.0.1/json.htm?type=setused&idx=119&tmode=0

just play around with those tmode values 🗡️

@user8446
Copy link
Author

https://127.0.0.1/json.htm?type=setused&idx=119&tmode=x always just returns status: "ERR" no matter the mode number.

Also weird I can return the mode number with domoticz.devices('1st floor Mode').mode or return the mode with domoticz.devices('Media room Mode').modeString but can't set it with domoticz.devices('Media room Mode').mode(0) or domoticz.devices('Media room Mode').modeString(Cool).

It errors with:
field 'mode' is not callable (a number value)
and
field 'modeString' is not callable (a string value)

galadril added a commit that referenced this issue Jun 27, 2023
@galadril
Copy link
Contributor

ok did some ground work, aldo the command url is not ready yet.
So it needs to be the whole url to work?

https://127.0.0.1/json.htm?type=setused&idx=119&name=1st%20floor%20Mode&description=&tmode=2&protected=false&used=true

can you maybe find out what properties are really needed to work (like description.. thats also weird)

@galadril
Copy link
Contributor

galadril commented Jun 27, 2023

i'm uploading some new version here on a alpha track, please enlist as tester so you get the test version if available:
https://play.google.com/store/apps/details?id=nl.hnogames.domoticz
https://play.google.com/store/apps/details?id=nl.hnogames.domoticz.premium

(Choose the app that you have, i guess the second link)
next version that has some change is: 671 (0.2.360 (9336))

@user8446
Copy link
Author

user8446 commented Jun 28, 2023

After testing the url:
https://127.0.0.1/json.htm?type=setused&idx=119&name=1st%20floor%20Mode&description=&tmode=0&protected=false&used=true

I found out that it works without the name=. It also works without protected= and changing from protected=false to protected=true did nothing. My guess is I think that it might just be reading that it is not a password protected device on the web page.

I also signed up for the beta on the domoticz premium app.

@kiddigital
Copy link

FYI

In current domoticz beta's type=setused is deprecated and should be type=command&param=setused

@user8446
Copy link
Author

Thanks @kiddigital I tried that format and it fails. I read #692 and the forum post and see there is only backward compat on the next couple of future versions.

@galadril
Copy link
Contributor

@kiddigital is setused also backwards compatible?

@galadril
Copy link
Contributor

@kiddigital
Copy link

@kiddigital is setused also backwards compatible?

Yes, see domoticz PR #5720

@user8446
Copy link
Author

Correct, https://127.0.0.1/json.htm?type=setused&idx=119&tmode=0&used=true works. used=true is mandatory and errors without it.

FYI also reading through the forum posts the backward compat will only be there for 12-18 months or so.

@galadril
Copy link
Contributor

galadril commented Jun 28, 2023

@user8446 looks like the alpha update should be in the store, i think it should at least show the mode in a dropdown combobox on the utilities page. could you check and make screenshot?

Mmm i uploaded it to closed alpha as its totally untested code.. i need your google email to whitelist you for alpha testing 🍡
maybe send it via DM on the Domoticz forum?
https://www.domoticz.com/forum/memberlist.php?mode=viewprofile&u=6986&sid=69f68f9c8bbfb172367b8deaa887e3ab

@user8446
Copy link
Author

Ok just sent a msg through the forum

@user8446
Copy link
Author

Ok just updating you I just got an update to 0.2.359 (9332) but haven't received 0.2.360 (9336) yet

@user8446
Copy link
Author

Ok I received version 0.2.360 (9336). Here is the screenshot:

Screenshot_20230630-083519

Screenshot_20230630-083531

After selecting a mode, I click on "set" and this pops up and then "ok" to try to set it. Only the mode "off" works. The other modes do not change but I see a log entry that something was sent to that thermostat:

Screenshot_20230630-083620

 2023-06-30 08:37:31.027 Sending Thermostat Mode to device....
2023-06-30 08:37:31.733 Aeotec Z-Wave stick: General/Thermostat Mode (2nd floor Mode) 

@galadril
Copy link
Contributor

galadril commented Jul 3, 2023

ive send a new version to google on the closed test track
673 (0.2.362 (9355))
lets see what that one does

@galadril
Copy link
Contributor

galadril commented Jul 5, 2023

plz check the latest version

@user8446
Copy link
Author

user8446 commented Jul 5, 2023

Ok this morning I just received 0.2.363 (9371) from 0.2.360 (9336) - I never received the 0.2.362 (9355).

The UI and behavior is the same. All selected modes will send an "off" through Domoticz and the UI will then display "cool".

@galadril
Copy link
Contributor

galadril commented Jul 5, 2023

Is it maybe possible to give me access on your system to that device? so i could try it out?
Maybe make a new user with only access to that one device?

@user8446
Copy link
Author

user8446 commented Jul 5, 2023

No problem sending a msg through the forum with the credentials now

@galadril
Copy link
Contributor

galadril commented Jul 5, 2023

thanks i did some more changes, new version is on tha way
676 (0.2.365 (9388))

@user8446
Copy link
Author

user8446 commented Jul 6, 2023

Just received 0.2.365(9388)

The UI is improved with the unneeded "Setpoint: 0.0" for the mode is removed.

Watching the logs and clicking between the modes doesn't send anything though. Is there supposed to be a set button or is it coded to send the command on pressing the mode?

Screenshot_20230706-110942

@galadril
Copy link
Contributor

galadril commented Jul 6, 2023

yes i indeed fixed the UI, also for the dashboard (if people put it on dashboard.)
But it should send the command right after choosing a mode from the combobox.

i actually tested that, copied the used http url and tested if that worked via the browser, as i could not really login to your system with the mobile app.

dont you see any log about the mode in domoticz??

@user8446
Copy link
Author

user8446 commented Jul 6, 2023

It changes in the app but nothing in the logs on this latest version. On the previous version it would show the command in the logs even though it would only turn to mode "off"

@rrozema
Copy link

rrozema commented Jul 6, 2023

This is not a bug in the mobile app, it is -a very old- bug in Domoticz/openzwave. The mode is sometimes interpreted as an index into an array of available modes and other times as the code for the mode. Off happens to be both code 0 and the first entry in the table, Heat has code 1 and is the 2nd entry, but for many other modes there is no match between the code.and the position in de he array. In openzwave/Domoticz is a check that silently ignores any invalid codes: thus no logging is shown when the bug is triggered. The same behavior of ignoring setting some modes can be observed in Domoticz -without the mobile app involved-.
(This bug is one of the main reasons why I stopped using Domoticz and switched to home assistant)

@user8446
Copy link
Author

user8446 commented Jul 7, 2023

Thanks for the info but that wouldn't be the issue here. Changing the modes with the Domoticz web front end works without fail. The API call is exactly the same as what the web front end uses. It doesn't matter whether it's from a script, app, or the web front end itself.
It shows in the log if I try to send an invalid API call or wrong mode using v2023.1.

Today I received v0.2.362(9351) - not sure why the version # went backwards but no change in behavior.

@galadril
Copy link
Contributor

galadril commented Jan 8, 2024

i assume still the case. dont really get why the api doesnt work, but its not really possible for me to test this

@user8446
Copy link
Author

user8446 commented Jan 8, 2024

Unfortunately still not working. API still works though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants