@chimera Hi, you may be able to use my MMM-ValuesByNotification for this job.
It is a little hack but i tested it and it seems to work.
The basic idea of the module is to display values send by notifications of other modules
BUT
the module has the ability to display a default value (naValue
) if no value has been send by any other module. It has abilities to display icons instead the value and change the icons based on thresholds (conditions). In combination with the support to define functions to format the values before the check of the conditions it will be possible to get the current time:
{
module: "MMM-ValuesByNotification",
position: "top_left",
header: "Energy",
config: {
updateInterval: 60,
valuePositions: "i",
valueNaPositions: "i",
itemPositions: "e",
groupPositions: "e",
formatNaValue: true,
transformerFunctions: {
naToImgIdent: (value) => {
let curHour = new Date().getHours();
if ((curHour >= 0) && (curHour <= 6)){
//From 0 to 6 o clock
return "a"
} else if ((curHour >= 7) && (curHour <= 12)) {
//From 7 to 12 o clock
return "b"
} else if ((curHour >= 13) && (curHour <= 18)) {
//From 13 to 18 o clock
return "c"
} else {
//From 19 to 23 o clock
return "d"
}
}
},
groups: [
{
items: [
{
notification: "ICON_DUMMY_ABC",
valueImgIcon: "modules/MMM-ValuesByNotification/icons/tom.jpg",
values: [
{
valueTransformers: ["naToImgIdent"],
thresholds: [
{
type: "eq",
value: "a",
valueImgIcon: "modules/MMM-ValuesByNotification/icons/tom.jpg",
},
{
type: "eq",
value: "b",
valueImgIcon: "modules/MMM-ValuesByNotification/icons/tom2.jpg",
},
{
type: "eq",
value: "c",
valueImgIcon: "modules/MMM-ValuesByNotification/icons/tom.jpg",
},
{
type: "eq",
value: "d",
valueImgIcon: "modules/MMM-ValuesByNotification/icons/tom2.jpg",
},
]
},
]
},
]
},
]
},
},
Edit:
I should have read your question in detail first :-)
If you can provide the state via MQTT already you can for sure use this module. You will need MMM-MQTTbridge to send the value as payload of a notification. Check for the notification in MMM-ValuesByNotification and display the icon you like.