This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues or pull requests.
automation/device/internal_name.go
Dreaded_X f13ee65ead
All checks were successful
continuous-integration/drone/push Build is passing
Added light sensor
2022-11-23 01:16:46 +01:00

32 lines
440 B
Go

package device
import "strings"
type InternalName string
func (n InternalName) Room() string {
s := strings.Split(string(n), "/")
room := ""
if len(s) > 1 {
room = s[0]
}
room = strings.ReplaceAll(room, "_", " ")
return room
}
func (n InternalName) Name() string {
s := strings.Split(string(n), "/")
name := s[0]
if len(s) > 1 {
name = s[1]
}
return name
}
func (n InternalName) String() string {
return string(n)
}