Dial with image from url from text-device

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
Maikel76
Posts: 71
Joined: Friday 14 August 2020 6:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Bangkok
Contact:

Dial with image from url from text-device

Post by Maikel76 »

Hi,
I have a music-player that updates a text-device in domoticz on every change. In this device the url on the internal network is updated like;

Code: Select all

http://raudio.local/data/webradio/img/https:||wwoz-sc.streamguys1.com|wwoz-hi.mp3-thumb.jpg
I can add a local image on the dial like this;

Code: Select all

blocks['Music'] = {
        idx: 180,
        title: false,
        type: 'dial',
        values: [
          {
          idx: 177,
          value: 'Level',
          image: 'coldwarm.jpg'
          last_update: false,
          isSetpoint: true,
          },
        ],
        width: 6,
        showring: true,
        shownumbers: true,
        showvalue: false,
        min:0,
        max: 100,
        last_update: false
}
However i try to do something like this;
custom.js

Code: Select all

function getStatus_179(block) {                            //iconpath for music
  var idx10 = block.idx;
  var device10 = block.device;
     if (device10['Data'] != '') {                        //if image is available
         Dashticz.setBlock(180, {         //Music Dial
            //image: device10.Data     <------- this one
            addClass: 'classImage'
            //image: 'coldwarm.jpg'
            //dialimage: 'http://raudio.local/data/webradio/img/https:||wwoz-sc.streamguys1.com|wwoz-hi.mp3-thumb.jpg'
         });
     } // end if
     else {                                                     //if image is empty
          Dashticz.setBlock(180, {         //Music Dial
            //image: ''
          });
     } //end if else
} // end funtion icon path music
none of the settings; dialimage, image, image:url('') is working unfortunately
as you can see i also tried to add the image trhrough a css class

Code: Select all

.classImage {
    background-image:url('http://raudio.local/data/webradio/img/https:||wwoz-sc.streamguys1.com|wwoz-hi.mp3-thumb.jpg');
}
I used these css-settings to fit the image inside the dial;

Code: Select all

.dial[data-id='Music'] .data {                     /* hide level value*/
    display: none;
}
.dial[data-id='Music'] img {                       /* position dial image */
    position: fixed;
    top: 25px;
    left: 25px;
    width: 80px!important;
    height: 80px!important;
}
Is there a way to add the image through the url as location??
Maybe somehow fit a frame inside the dial? I don't know how I should do that

Please help
Edit: opened a feature request on Github for this, dialimage isn't supported yet (fully) I think
Last edited by Maikel76 on Monday 06 November 2023 7:06, edited 1 time in total.
Scripting is my passion, dzVents, LUA, Bash
Dashticz v3.10.7 Beta --Raspbian Buster
Maikel76
Posts: 71
Joined: Friday 14 August 2020 6:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Bangkok
Contact:

Re: Dial with image from url from text-device

Post by Maikel76 »

Noone any idea??
Scripting is my passion, dzVents, LUA, Bash
Dashticz v3.10.7 Beta --Raspbian Buster
Lokonli
Posts: 2290
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dial with image from url from text-device

Post by Lokonli »

Maikel76
Posts: 71
Joined: Friday 14 August 2020 6:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Bangkok
Contact:

Re: Dial with image from url from text-device

Post by Maikel76 »

Hi Sander,
The image in the dial derived from the url source is working like a charm, many thanks for that!
I have a question though: Is it correct that the option isSetpoint can only be used once?
In other words, if the main dial device is an On/Off switch, then without configuration the isSetpoint is set to turn the switch
However if I add a value in the outer-ring as a dimmer and set this as isSetpoint, then the switch isn't working anymore. Taking away the isSetpoint setting enables the switch function. My CONFIG.js is as follows;

Code: Select all

blocks['Music'] = {
        values: [
          {
          idx: 177,
          value: 'Level',
          last_update: false,
          isSetpoint: true, //<-- this will disable the switch wirh idx 180
          min:0,
          max:100,
          },
          //{
          //idx: 180,
          //subType: 'Switch', //switchMode: 'Toggle',
          //switchMode: 'On/Off',
          //value: 'Data',
          //isSetpoint: true,
          //}
        ],
        idx: 180,
        title: false,
        type: 'dial',
        width: 6,
        showring: true,
        shownumbers: true,
        showvalue: false,
        //min:0,
        //max: 100,
        last_update: false,
        backgroundimage: 179,
        backgroundsize: '95%',
}
Scripting is my passion, dzVents, LUA, Bash
Dashticz v3.10.7 Beta --Raspbian Buster
Maikel76
Posts: 71
Joined: Friday 14 August 2020 6:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Bangkok
Contact:

Re: Dial with image from url from text-device

Post by Maikel76 »

Can anyone help??
Scripting is my passion, dzVents, LUA, Bash
Dashticz v3.10.7 Beta --Raspbian Buster
Lokonli
Posts: 2290
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dial with image from url from text-device

Post by Lokonli »

You can combine an on/off switch with a read-only needle by adding 'isNeedle: true'

Currently it's not possible to combine on/off functionality with a setpoint device.
Lokonli
Posts: 2290
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dial with image from url from text-device

Post by Lokonli »

Easier to fix than I first thought.

In latest beta you can combine an 'onoff' dial with a setpoint device.
Maikel76
Posts: 71
Joined: Friday 14 August 2020 6:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Bangkok
Contact:

Re: Dial with image from url from text-device

Post by Maikel76 »

Hi,
I just see this now, super! I will try it now
Once again thanks a lot, much apreciated
Scripting is my passion, dzVents, LUA, Bash
Dashticz v3.10.7 Beta --Raspbian Buster
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest