Same on android beta
I assume you installed this through the marketplace? Could you try to add this widget manually in the Dev Tools and see if it looks strange there as well?
same problem, in fact, all the design chnage between chrome and the android app is strange
chrome:
App android
obviously is not your widget
Ok let me know if you find something related to my widget
You might want to consider opening another issue for your problem to find someone who is able to help.
yes, thanks !
Hi Thomas,
Thank you for those awesome widgets youāve createdā¦
Currently iām moving from my old files based Setup to MainUI only and iām struggling a bit on how to set the items,scripts and rulesā¦
So far i have setup my wallplug item with the energy consumption and the washing_machine_state / -runtime itemsā¦
Iād Like to use this rule since it makes it easier to get washingmachine,dryer,dishwasher items/widgets setupā¦
Now iām a bit confused which scripts/rules do i needā¦ And where to put Themaā¦ And would like to ask if you could share some more details on your current multi item rulesetupā¦
Thanks
Hi Holger,
I agree it can get a bit confusing at timesā¦
Youāll need two rules in total and your item names must meet some requirements:
- Rule to determine the current status of your device (see rule I shared a couple of posts before this one). This rule should be triggered whenever one of the outlets consumption values changes.
- Rule to determine the time since the last status change (see step 3 in other post above: Washing machine status widget - #3 by DrRSatzteil). This should be fired every minute as long as the device is in RUNNING state. I still have this rule three times separately for every deviceā¦
Item name requirements:
Since the energy consumption profile of my devices (dishwasher, dryer and washing machine) differs every device must be configured differently. To do so I created a couple of items that also allow me to easily tweak the rule if something is not working as expected. Rule 1. relies on some conventions to find the corresponding items:
- Your outlet must be modelled as equipment in the semantic model. The triggering item must be a Point of this equipment.
- Your washing machine must be represented by a group (ideally but not necessarily part of the semantic model) thatās named as the outlet without a leading string āoutlet_ā (e.g. washing and outlet_washing)
- The config items need to be members of a group named exactly like your washing machine group equipment with a ā_configā suffix (e.g. washing and washing_config). This group must be a member of the washing group in this example.
- The config group must contain three items with the following names (following the āwashingā example)
a) washing_config_threshold: Actually not a good name: this Number Item value sets the expected energy consumption when the washing machine is finished. Whenever the consumption changes to a value below this value we start a timer with the time configured in c). If the value doesnāt go above this threshold while we wait we assume that the washing is finished. Especially washing machines sometimes do almost nothing for a couple of minutes which can easily lead to false positives.
b) washing_config_zero: Number Item that determines when your machine is considered to be off (should ideally be 0 if your device does not consume standby power)
c) washing_config_waittime: Number Item that was already explained in a). Configures the time we wait until we assume that the washing is really finished and was not just having a little break.
d) washing_config_icon: This string item is optional and represents the name of the icon that will be used in the notification message. Defaults to āwhitegoodā.
Donāt forget to enable persistence for all of these or otherwise you will lose your settings during reboot.
Iām pretty sure I forgot something but this should get you started anyway. Feel free to ask if you need any more assistance.
Can anybody help me with formatting a number?
gives me
Iād like to display integers, like ā35 Wattā. Can anybody help me formatting the header string?
Metadata / State description wonāt help
Try state.split(ā.ā)[0] + ā Wattā
If you want to use the state description you need to use displayState instead of state.
THX! displayState worked perfectly.
Wonderful widget, by the way!
hello, iām in trouble with this ruleā¦when i run it it gives me many errors:
2022-02-07 16:06:49.052 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'd3264944b9' failed: var logger = ___ Java.type("org.slf4j.LoggerFactory").getLogger("scripts.washing.runtime");
var PersistenceExtensions = Java.type("org.openhab.core.persistence.extensions.PersistenceExtensions");
var ZonedDateTime = Java.type("java.time.ZonedDateTime");
var Duration = Java.type("java.time.Duration");
var lastUpdate = PersistenceExtensions.lastUpdate(ir.getItem('Asciugatrice_kWhMinuto'), "mapdb");
logger.info('Status della asciugatrice cambiato alle ' + lastUpdate);
var minutesSinceLastUpdate = Duration.between(lastUpdate, ZonedDateTime.now()).toMinutes();
logger.info('Status della asciugatrice cambiato ' + minutesSinceLastUpdate + ' minuti fa');
events.postUpdate('Asciugatrice_Runtime', minutesSinceLastUpdate);
1. The method or field Java is undefined; line 1, column 13, length 4
2. The method or field Java is undefined; line 2, column 116, length 4
3. The method or field Java is undefined; line 3, column 212, length 4
4. The method or field Java is undefined; line 4, column 265, length 4
5. The method or field ir is undefined; line 5, column 348, length 2
6. The method or field events is undefined; line 9, column 650, length 6
can you help me on whatās wrong?
this is my entire rule code:
configuration: {}
triggers:
- id: "2"
configuration:
cronExpression: 0 * * * * ? *
type: timer.GenericCronTrigger
conditions:
- inputs: {}
id: "3"
configuration:
itemName: Asciugatrice_OpState
state: "2"
operator: =
type: core.ItemStateCondition
actions:
- inputs: {}
id: "1"
configuration:
type: application/vnd.openhab.dsl.rule
script: >-
var logger = Java.type("org.slf4j.LoggerFactory").getLogger("scripts.washing.runtime");
var PersistenceExtensions = Java.type("org.openhab.core.persistence.extensions.PersistenceExtensions");
var ZonedDateTime = Java.type("java.time.ZonedDateTime");
var Duration = Java.type("java.time.Duration");
var lastUpdate = PersistenceExtensions.lastUpdate(ir.getItem('Asciugatrice_kWhMinuto'), "mapdb");
logger.info('Status della asciugatrice cambiato alle ' + lastUpdate);
var minutesSinceLastUpdate = Duration.between(lastUpdate, ZonedDateTime.now()).toMinutes();
logger.info('Status della asciugatrice cambiato ' + minutesSinceLastUpdate + ' minuti fa');
events.postUpdate('Asciugatrice_Runtime', minutesSinceLastUpdate);
type: script.ScriptAction
widgets seems to work perfectly but remaining time is not working, keep displaying NaaN:NaaN, but animations works.
widget config is this one:
whatās wrong?
You need to create an ECMA JavaScript rule and paste the code there. You created a DSL rule. This should fix your problems
OMGā¦crazy for this. ok iāve changed it, i will check that everything else is okay.
thanks a lot for this hint!
iāve set it to ECMAScript (ECMA - 262 Edition 5.1) and in log i have no more errors, but in the widget, i have the running minute counter that start from 0:00 and count till 0:04 and then reset to 0:00.
some other times, count till 0:01 and then back to 0:00 and other times, til 0:02 and back to 0:00.
any idea?
It might be that your configuration items need some fine tuning: what are your waittime and threshold parameters? It seems that your machine consumes less than the threshold for a short period and your waittime is even lower than this period.
this is the rule to get the status of the dryer:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: Asciugatrice_kWhMinuto
type: core.ItemStateChangeTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/vnd.openhab.dsl.rule
script: >-
val Number MODE_OFF = 0
val Number MODE_STANDBY = 1
val Number MODE_ACTIVE = 2
val Number MODE_FINISHED = 3
logInfo("Asciugatrice Status","Regola in esecuzione")
if (Asciugatrice_kWhMinuto.state < 0.001 | kWh) {
Asciugatrice_OpState.postUpdate(MODE_OFF)
logInfo("Asciugatrice Status","Asciugatrice SPENTA")
} else if (Asciugatrice_kWhMinuto.state > 0.300 | kWh) {
Asciugatrice_OpState.postUpdate(MODE_ACTIVE)
logInfo("Asciugatrice Status","Asciugatrice IN ASCIUGATURA")
} else if (Asciugatrice_kWhMinuto.state < 0.100 | kWh) {
Asciugatrice_OpState.postUpdate(MODE_STANDBY)
logInfo("Asciugatrice Status","Asciugatrice in STANDBY (Status "+Asciugatrice_OpState.state+")")
} else if (Asciugatrice_kWhMinuto.state < 0.003 | kWh) {
Asciugatrice_OpState.postUpdate(MODE_FINISHED)
logInfo("Asciugatrice Status","Asciugatrice ha FINITO (Status "+Asciugatrice_OpState.state+")")
}
type: script.ScriptAction
and this is the rule to get the running time:
configuration: {}
triggers:
- id: "2"
configuration:
cronExpression: 0 * * * * ? *
type: timer.GenericCronTrigger
conditions:
- inputs: {}
id: "3"
configuration:
itemName: Asciugatrice_OpState
state: "2"
operator: =
type: core.ItemStateCondition
actions:
- inputs: {}
id: "1"
configuration:
type: application/javascript
script: >-
var logger =
Java.type("org.slf4j.LoggerFactory").getLogger("scripts.washing.runtime");
var PersistenceExtensions = Java.type("org.openhab.core.persistence.extensions.PersistenceExtensions");
var ZonedDateTime = Java.type("java.time.ZonedDateTime");
var Duration = Java.type("java.time.Duration");
var lastUpdate = PersistenceExtensions.lastUpdate(ir.getItem('Asciugatrice_kWhMinuto'), "mapdb");
logger.info('Status della asciugatrice cambiato alle ' + lastUpdate);
var minutesSinceLastUpdate = Duration.between(lastUpdate, ZonedDateTime.now()).toMinutes();
logger.info('Status della asciugatrice cambiato ' + minutesSinceLastUpdate + ' minuti fa');
events.postUpdate('Asciugatrice_Runtime', minutesSinceLastUpdate);
type: script.ScriptAction
i also have āscripts.washing.runtimeā for 3 different rules. do i have to rename this to avoid any conflict?
also for this second rule, i donāt get any log info when runsā¦