Page 1 of 1

How to change the value of a device?

Posted: Friday 05 March 2021 17:53
by TroisSix
Hi huys,

I have some shutters (blinds) and I would like to change the value displayed cause it's in uppercase.
I tried the textOn/textOff but it's not working.
I tried the custom.js with function getStatus_MyBlind(block), and I can change the title (with block.title=), but how to change the value?

Thanks for your help ;)

Re: How to change the value of a device?

Posted: Friday 05 March 2021 20:36
by Lokonli
TroisSix wrote: Friday 05 March 2021 17:53 Hi huys,

I have some shutters (blinds) and I would like to change the value displayed cause it's in uppercase.
I tried the textOn/textOff but it's not working.
I tried the custom.js with function getStatus_MyBlind(block), and I can change the title (with block.title=), but how to change the value?

Thanks for your help ;)
It was hardcoded as ON and OFF (translated according your language setting).

I've just changed in latest beta that the textOn/textOff parameters can be used. Can you test?

Re: How to change the value of a device?

Posted: Friday 05 March 2021 22:25
by TroisSix
Ok I will search a way to upgrade from the master to the beta, and come back to you, thanks ;-)
Edit: is that enough to upgrade from master to beta: (with a copy of the config js and co) ?

Code: Select all

. <(wget -qO - https://raw.githubusercontent.com/Dashticz/dashticz/beta/scripts/dashticz_install.sh )
and is there a way to hide a block? cause I discovered that I need some buttons for the js and change the colors of other blocks, but I don't want to display these ones.

Re: How to change the value of a device?

Posted: Friday 05 March 2021 22:47
by Lokonli
TroisSix wrote: Friday 05 March 2021 22:25 Ok I will search a way to upgrade from the master to the beta, and come back to you, thanks ;-)
Edit: is that enough to upgrade from master to beta: (with a copy of the config js and co) ?

Code: Select all

. <(wget -qO - https://raw.githubusercontent.com/Dashticz/dashticz/beta/scripts/dashticz_install.sh )
and is there a way to hide a block? cause I discovered that I need some buttons for the js and change the colors of other blocks, but I don't want to display these ones.
To be able to recover from mistakes, make a copy of CONFIG.js, custom.css and custom.js.

Then, normally the following should be sufficient to switch to beta:

Code: Select all

git checkout beta
Update to latest version with:

Code: Select all

git pull
If git reports errors, then check this first:
https://dashticz.readthedocs.io/en/beta ... 27-12-2020

Re: How to change the value of a device?

Posted: Saturday 06 March 2021 11:23
by TroisSix
Hi
I removed the master version in /home/pi/dev/dashticz, and installed the beta with :

Code: Select all

 git clone https://github.com/Dashticz/dashticz dashticz --branch beta
 cd dashticz/
 git pull
 sudo apt-get update
 sudo apt-get install apache2 php php-xml php-curl libapache2-mod-php
 sudo systemctl restart apache2
 sudo ln -s /home/pi/dashticz/ /var/www/html
 chmod -R a+rX /home/pi/dashticz
 sudo a2enmod php7.3
 sudo systemctl restart apache2
My dashticz is not working anymore, it displays "Dashticz v3 is loading..." and I don't know where to search :o

Edit: I was trying to reach dashticz on the port 8082, it was simply the port 80... I continue my tests :arrow:

Re: How to change the value of a device?

Posted: Saturday 06 March 2021 11:41
by TroisSix
@Lokonli
So I confirm the textOn/textOff is working fine with the latest beta: I can specify the text I want even for my blinds, great guys ;)

Is there also a way to modify this state of another block within a function function getStatus_MyBlock(block)?
Dashticz.setBlock('AnotherBlind', {title: 'New title'}); is working to update the title of the blind, but what's the way to modify its data/value/state?

Re: How to change the value of a device?

Posted: Sunday 07 March 2021 0:09
by Lokonli
TroisSix wrote:@Lokonli
So I confirm the textOn/textOff is working fine with the latest beta: I can specify the text I want even for my blinds, great guys ;)

Is there also a way to modify this state of another block within a function function getStatus_MyBlock(block)?
Dashticz.setBlock('AnotherBlind', {title: 'New title'}); is working to update the title of the blind, but what's the way to modify its data/value/state?
You could set the value parameter via the setBlock function.

Can you describe in more detail what you try to achieve?

Sent from my SM-A320FL using Tapatalk


Re: How to change the value of a device?

Posted: Sunday 07 March 2021 8:33
by TroisSix
I would like to do something like:
Dashticz.setBlock('AnotherBlind', {value: 'Opened 80%'})

Re: How to change the value of a device?

Posted: Tuesday 09 March 2021 16:21
by TroisSix
I reply to myself, to change the value of a device, we have to change the value displayed in textOn/textOff, nothing else to do.

@Lokonli
Is it possible to change an image the same way?
I tried a

Code: Select all

Dashticz.setBlock('shutter', {imageOn: 'personal/shutter_mi_opened.png'});
but it's not working :?

Re: How to change the value of a device?

Posted: Tuesday 09 March 2021 19:00
by Lokonli
It should work like that, but I did not test this for blinds.

Is your image in the folder 'image/personal/'?
Does it work for regular switches?

Sent from my SM-A320FL using Tapatalk


Re: How to change the value of a device?

Posted: Tuesday 09 March 2021 21:50
by TroisSix
My images are in img/perso/ yes. I tried with and without the /img
Ok, I will test it with some regular switches 😉

Re: How to change the value of a device?

Posted: Wednesday 10 March 2021 10:48
by TroisSix
@Lokonli: Ok, I got it.
In fact, the same way we modify the textOn/textOff, we have to modify the imageOn/imageOff (and not only the image) ;)

Code: Select all

Dashticz.setBlock('MyShutter', {textOff: 'partially closed ' + device['Value'] + '%', imageOff: 'perso/shutter_80.png'});
Could be useful to add it in the tutorial if it can helps the others.

PS: problem solved if you want to close this thread. Thanks Lokonli for your support 8-)